Recently in a project with multiple people, a commit was made as seen in the image below. Marked in red you can see a commit with the description/comment of 'Merge?'.
This commit added numerous files and altered numerous others and was never intended to take place.
Using atlassian-sourcetree what do I need to do to roll everything back to the commit highlighted in blue? (I am 8 commits behind as seen in the screenshot.)
Select the commit you would like to roll back to and reverse the changes by clicking Reverse File
, Reverse Hunk
or Reverse Selected Lines
. Do this for all the commits after the commit you would like to roll back to also.
Right click on the commit and click on Reset current branch to this commit
.
I searched for multiple options to get my git reset to specific commit, but most of them aren't so satisfactory.
I generally use this to reset the git to the specific commit in source tree.
select commit to reset on sourcetree.
In dropdowns select the active branch , first Parent Only
And right click on "Reset branch to this commit" and select hard reset option (soft, mixed and hard)
and then go to terminal git push -f
You should be all set!
There are two options to revert one commit our merged branch.
A. Using sourcetree
B. Using terminal
Select your commit and look info on bottom side of screen. Example commit id: 1a6cd9879d8c7d98cdcd9da9cac8979dac7a89c
Click top right corner "Terminal" option of Sourcetree.
Write in terminal: git revert your_commit_id -m 1
When the commit message editor opens up:
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