I am on branch A
. I have branch B
which has commit 1eB4ad
. I want all changes (the diff, the entire commit of 1eB4ad
) to be applied to A
's working tree and staging area. So say commit 1eB4ad
added file1.txt
and file2.txt
, then after this command, branch A
will have file1.txt
, and file2.txt
in the working tree as well as tracked but un-added to the staging area/index. Which command or series of commands can accomplish this end state?
Asked
Active
Viewed 1,413 times
2

Alex Bollbach
- 4,370
- 9
- 32
- 80
-
that topic did wind up solving my problem, although i wouldn't have found it so easily because i didn't know cherry-pick was a necessary command. So I worded my question as command-agnostically as I could. – Alex Bollbach Jun 27 '17 at 04:08
1 Answers
5
Cherry pick is the command you're looking for:
https://git-scm.com/docs/git-cherry-pick
Without the commit use the -n flag:
git cherry-pick -n 1eB4Ad

Gov
- 375
- 1
- 9
-
i don't want to add the commit to branch `B` but just apply its changes. So I believe `git cherry-pick -n
` will do that. `-n` for no commit. i'd accept your answer given that extra info, if correct. – Alex Bollbach Jun 27 '17 at 03:47 -
1Correct: `git cherry-pick -n 1eB4Ad` Will omit the commit and apply the changes to your working tree (and staging area). You can then make any further modifications and commit at a later time – Gov Jun 27 '17 at 04:11