I have a master
branch and a develop
branch. The develop
branch has moved ahead of the master
by about 10 commits, but the version approved by the client included only the first 8 commits.
How do I merge only the first 8 commits from develop
into master
?
Normally I would do this:
git checkout master
git merge develop
But obviously that would merge in all of the develop
commits.
You may merge via SHA-1 commit hash, e.g.
git checkout master
git merge 3JH9sdx8
Where 3JH9sdx8
is the commit hash of develop
from two commits prior to the HEAD of the branch. To find that 3JH9sdx8
hash, you could use git log develop
and check.
You can create a branch 2 version back
git checkout dev
git checkout -b devapproved @~2
Then you can merge that branch
git checkout master
git merge devapproved
you could get the merge's version and create temporary branch ,for example:
# find the commit id
git log --oneline
# checkout new branch by commit id
git checkout commitID -b tmp
# Switched to branch 'master'
git checkout master
git merge tmp
# delete branch
git branch -d tmp
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With