Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to commit one file at a time

cyberpunkstudio April 12, 2012

Just started using Source Tree. Finding it slightly confusing, there's no documentation anywhere telling you how to use this. Be helpful if there was.

When I added files to be staged in the index, how do I commit just the individual files? Because when I try to commit one file out of the host of files in the index it tries to commit the whole lot. I just want to commit the one. But I still want all the other added files to sit in the index for now, so I can add personal commit comments to each single file or multiple lot.

Also is it possible to add and commit a file that is not yet added in one go?

3 answers

1 accepted

1 vote
Answer accepted
stevestreeting
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.
April 15, 2012

A couple of ways to do this:

  1. Right-click a single file (or indeed any file selection) and select 'Commit'
  2. Open the commit dialog any way, and change the 'Commit mode' to 'Commit all changes from selected files in the working tree'. Check the files you want to commit (staging doesn't matter) and click OK.
stevestreeting
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.
April 15, 2012

Also note that if you don't like to use the staging mode of committing in git, go into Preferences > Git and uncheck the box 'Use the staging area'. From then on the commit mode will always be based on selected files and not the staged changes.

cyberpunkstudio April 16, 2012

unchecking 'Use the staging are' worked perfectly. Now I can commit individual files where before all files in the staging area gets committed altogether and no way of unticking them.


Thanks

0 votes
MikeL April 12, 2012
Git allows to commit certain files, even if they or others are staged.
0 votes
tier-0 grump
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 12, 2012

It's not really a SourceTree problem here - if a file is staged in git then it gets committed. If you only want to commit one file,than only add that file - if you've already added the file to staging then remove them form the staging area using the remove button before pushing.

i don't use sourcetree often, so don't know the answer to your second part.

MikeL April 12, 2012
Git allows to commit certain files, even if they or others are staged.
cyberpunkstudio April 12, 2012

Yes exactly Git allows you to commit certain files even if they're not staged. But how the hell do you do this in Source Tree??!

MikeL April 12, 2012

I haven't found a way to do that with SourceTree. But with smartGit.

cyberpunkstudio April 13, 2012

Can't believe this killer app can do so many things yet can't do a simple job of just committing individual items.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events