SourceTree File Status

matthewsohswg May 9, 2015

Is this a FAQ for the file statuses in SourceTree? I have a file that shows up in Staged as well as Unstaged, with the one in the latter with the "Clean" status. What does that mean?

I got here after doing a soft reset.

 

2015-05-09_08-21-51.png

Git status shows what I expected

2015-05-09_08-22-53.png

 

Thanks
   Matt


 

 

3 answers

0 votes
matthewsohswg May 11, 2015

Johannes,

No I did not edit the file after staging it. I started off with a clean index and working directory, then I did 

git reset --soft HEAD~2

to arrive at what you saw (see Git Reset). I did not modify the file afterwards, index and working directory are the same.

You can see that git on the command line is reporting what we think correctly, but SourceTree is showing a "clean" file.

Seth, you are right, I had my filter set to All. I guess to SourceTree, clean means working directory is the same as index. I thought it might have been something related to reset. 

thanks
   Matt 

 

Johannes Kilian
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 11, 2015

Ooops ... should have read the question more detailed ... I think your guess is right: git is already "aware" of your previous changes, as you staged your changes already. Therefore the state of your file in your working directory is clean (as your changes are already delivered to the staging area, where your file is stated as modified ...)

0 votes
Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 11, 2015

Actually, it looks like you have the SourceTree filter set to All Files (I typically use Pending). The All Files filter will show all files, regardless of status, in the unstaged pane.

0 votes
Johannes Kilian
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 10, 2015

This is a feature of git. You probably came into this situation by editing the file AFTER you staged it.

Staging takes a snapshot of the current file and puts it into the "staging area" (aka Index). If you edit your file after staging it, the snapshot within your working directory differs from the snapshot within the index (and the snapshot within index differs from snapshot in your repository). If you add your file again to the index (via git add), the situation changes: the snapshot in your working directory and the index are the same again - and you will only see the file in the staging area.

For more detailed information you might take a look for example here

This feature can be used for example to "git add" several changes of your file to the index (and to commit those changes) while ommitting other changes from the commit ,,,

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events