Equivalent to svn's "revert changes from this revision" on single file

Your version control history situation:

  • Commit 1 : changed misc stuff
  • Commit 2 : changed foo.cs and bar.cs
  • Commit 3 : change misc stuff
  • Commit 4 : changed foo.cs

Your goal is to undo the changes to file foo.cs done at commit 2.

 


 

In (tortoise) svn this would be done like so...

  • Right click foo.cs, choose Show Log
  • Log Browser window appears showing commit history filtered to only contain commits which modified the file foo.cs (aside: SourceTree also lakes a convenient way to show a sequential log of changes which affect a path within a repo).
  • Selecting commit 2 shows all files changed in the lower window
  • Right clicking on foo.cs in the bottom window shows context option 'revert changes from this revision'.

Note that this is distinctly different from right clicking on the entire commit within the upper window and choosing the same option 'revert changes from this revision' as one will revert all files and the other only the currently selected files.


 

SourceTree / Git appears to call this similar feature a 'reverse commit'.

However it only shows this as a context menu option for COMMITS. What I want is the ability to reverse commit the currently selected file(s) in the lower window (when a commit is selected in the upper window).

2 answers

In the diff panel when viewing the commit, you can reverse individual hunks from files, or hit the "..." in the upper right of the diff panel to reverse all changes in a file.

Thanks, that appears to be designed to do what I want. Although it actually showed me a dialog box saying it failed for unknown reasons in this particular case... I just manually deleted the method I had added.. really it was just adding a single new method, it shouldn't have been any sort of conflict to revert it, and even if it was it should have allowed me to resolve it as a conflict and not just done nothing...

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published May 11, 2018 in Sourcetree

Tip from the team: debugging Sourcetree

Supported Platforms macOS Windows If you're reading this and it's not just educational… we know you're unhappy right now and apologize for that   We're dedicated to improving yo...

114 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you