SourceTree File Status

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

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 ,,,

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.

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 

 

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 ...)

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Brian Ganninger
Published Jan 23, 2018 in Sourcetree

Tip from the team: workflow and keyboard shortcuts

Supported Platforms macOS Sourcetree has a lot to offer and, like many developer tools, finding and using it all can be a challenge, especially for a new user. Everyone might not love ...

649 views 0 4
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