Commit hunks/staged files with sourcetree?

Oliver Smith July 5, 2013

Scenario: While working on a task/feature, you fixed a small bug in an unrelated area of one of the files you changed. At commit, you'd like to commit that separately.

Tried staging the hunk I wanted to commit,
- There is no option to commit what is staged,

Tried staging what I didn't want to commit,
- Everything I'd staged also appeared in the commit anyway,

Tried discarding what I didn't want to commit,
- Actually removed/reverted the change from the source file.

So what is the intended workflow for cherry picking a subset of changes and commiting just them? Am I missing something obvious?

3 answers

0 votes
Oliver Smith July 27, 2013
0 votes
Oliver Smith July 13, 2013

Hi, Kieran, Sorry for the delayed reply - it was for Windows but the pathalogical behavior went away and the workflow is now actually pretty nice -- one simply selects "Commit" from the button bar or on the "Uncomitted changes" view and then "stage hunk" or "stage selected lines", which automatically takes you into "Staged changes" view mode, and in that mode you can cherry pick hunks or individual lines to commit.

The only disadvantage to this right now is that when you "stage file" the view refreshes and resets the selected file to the top file in the list.

Lets say you just removed a #include from include/pch.h and you want to commit adding the include to the src/*.cpp files. This gets annoying, fast, because every time you "stage file" from a src file, it resets the current file to h/pch.h.

KieranA
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.
July 15, 2013

Hi Oliver,

Thanks very much for the insight. This sounds to me like you'd like it to behave in a different manner. If so, could you possible file a new issue on jira.atlassian.com (project SRCTREEWIN) with as much detail as possible? Feature requests go there usually and they're reviewed periodically with feedback given and hopefully assigned to an issue.

Thanks very much

0 votes
KieranA
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.
July 7, 2013

Hi Oliver. Is this for Windows or Mac?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events