I use BitBucket and SourceTree. I have two branches called Dev_1.2.2 and Dev_1.2.3
I committed some files on Dev_1.2.2 but did not push. I don't want to commit or push these files on Dev_1.2.2, I made commit successfully thus files on Dev_1.2.3 but can't revert/remove the commit from Dev_1.2.2.
How can I revert this commit from the branch using SourceTree?
Not entirely sure what you're asking but I can see two options:
To reverse the specific commit in SourceTree, do the following:
Dev_1.2.2 branch by double-clicking it in the list of branches on the left.That should do it, it will create a reversal commit. Your history will now show that you first added the files, and then a second commit showing that you removed them again.
If you want to get rid of the whole commit without it showing in history, you can reset the branch to the commit before you added the files.
To do that, you need to do the following:
Dev_1.2.2 branch by double-clicking it in the list of branches on the left.Warning: This will mean you lose any changes made after the selected commit. Your branch will be reset to this commit.
You can use "Rebase children of [commit hash] interactively" on a commit that is below the one you want to delete.
Then use "delete selected".
Note, this rewrites the commit date, which you can fix from command line using git rebase --committer-date-is-author-date [commit hash].
After rebase, you will need to git push --force.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With