Search code examples
gitatlassian-sourcetreesourcetree

Is it possible to unstage (or reset) a file in SourceTree and, if so, how is it done?


Consider the case where you have a working copy with 2 changed files, which you want to commit individually (IE: make 2 commits). Using git directly you can:

git add change1.txt

to "stage" change1.txt for the next commit. If you then decide you want to commit change2.txt first, you can:

git reset change1.txt
git add change2.txt

to swap the files between staging/working copy without undoing the changes in the files.

I am trying to help a colleague do this using a GUI - in this case, SourceTree by Atlassian - but I can't figure it out.

There is an "Add" command, which successfully adds a file to the staging area. However, there is no "reset" command (at least none I can find). There is a "Remove" command, but using it warns:

The following files contain changes or information which is not in source control, and will be irretrievably lost if you remove them:

Which means it cant be simply moving the file from staging back to working copy (like git reset would do).

Is there any way to perform a simple "un-stage" as described for change1.txt above using SourceTree?


Solution

  • Select the file(s) and click "Unstage Selected":

    enter image description here