Git tips & tricks part 4: more on cherry picking
In my previous post I discussed how it was possible to merge individual changes from one branch to another. At that time I mentioned using the log on the original branch to figure out which changes were available to merge, but it turns out there’s an easier way.
Let’s say you made some changes in local-trunk and you want to merge them into your branch-1.5 which is your release branch. From the branch:
git cherry -v local-trunk
+ 08d7780de7e16a22b7e8ed1d42acebc4bc07573f a changeset i haven't merged yet
- 78a7b285089c76664a530f68803259c53cbadb42 another change
Each line indicates a change. If it has a “+” it means they only exist in the local-trunk. A minus indicates changes that have already been merged in. Magic! Now that you know which changes you want, just cherry-pick them in.
git cherry-pick 08d7780de
Update: here’s another cool trick to see where every branch is at
git branch -v
Output looks like this:
branch 317544a #520 fix single page build
local-trunk ec85f65 #520 fix single page build










No Comments Yet