Reputation: 19247
While working on a development branch (newstuff) I had a situations where I had to branch a temporary fix (quickfix) from a commit that was one behind my (master) and push it to a server.
That was easy and worked fine, so that server is running the quickfix branch.
My question is how to merge all the changes (newstuff + quickfix) back into master, without running into a merge conflict.
Not sure if I should do a cherry-pick, or a merge, and in which order.
The quickfix changes a handful of lines that have not been altered my current (master) or my current (newstuff) branches, so the actual changes in quickfix will not cause any merge conflict.
A picture helps: my git repo looks like this (aaaaa is the common ancestor)
aaaaa
bbbbb --> xxxxx <== quickfix
ccccc <== master
ddddd
eeeee
fffff
ggggg <== newstuff
Upvotes: 0
Views: 123
Reputation: 1312
In such situations where you want some commits to be added/pushed to the master, you may go for cherry-pick.
It will allows you to add ONLY that commit which is useful.
AFAIK, you can do the following commands :
git checkout master
(Switch from the test/quickfix branch to master branchgit cherry-pick <commit ID>
(Pick up only that commit ID which you want to take)git log
(To check that the particular commit ID is cherry-picked or not.Check this out, it may work. :)
Upvotes: 0
Reputation: 2421
Just merge them in any order
# v1
$ git checkout master
$ git merge quickfix
$ git merge newstuff
# v2
$ git checkout master
$ git merge newstuff
$ git merge quickfix
Upvotes: 1