Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
git:merge-into-master [2009/06/04 10:51] andrei |
git:merge-into-master [2012/12/11 16:50] (current) oej old revision restored |
||
---|---|---|---|
Line 3: | Line 3: | ||
* if you don't have a local **master** branch tracking **origin/ | * if you don't have a local **master** branch tracking **origin/ | ||
< | < | ||
+ | git fetch origin | ||
git checkout --track -b master origin/ | git checkout --track -b master origin/ | ||
</ | </ | ||
Line 10: | Line 11: | ||
< | < | ||
git checkout master | git checkout master | ||
+ | # make sure we have the up-to-date " | ||
+ | git fetch origin | ||
# make sure the local " | # make sure the local " | ||
git pull --rebase origin master | git pull --rebase origin master | ||
+ | </ | ||
+ | |||
+ | * do the actual merge | ||
+ | |||
+ | < | ||
# merge the branch into the local " | # merge the branch into the local " | ||
git merge --log --no-ff origin/ | git merge --log --no-ff origin/ | ||
git log -1 # make sure you see a correct merge message (with summary), if not abort | git log -1 # make sure you see a correct merge message (with summary), if not abort | ||
+ | git log ORIG_HEAD.. # make sure the commits shown are what you wanted to merge, if not abort | ||
gitk # optional, look if the commit tree looks ok | gitk # optional, look if the commit tree looks ok | ||
# only if everything is ok and you looked at the log | # only if everything is ok and you looked at the log | ||
Line 21: | Line 30: | ||
</ | </ | ||
- | * if you did something wrong and pushed, and it cannot be easily corrected by a git revert, send an email to sr-dev@lists.sip-router.org asking to revert master to the previous state (this should be avoided in general since it would cause extra work for all people who fetched or pulled master in the meantime) | + | * if you did something wrong and pushed and it cannot be easily corrected by a git revert, send an email to sr-dev@lists.sip-router.org asking to revert master to the previous state (this should be avoided in general since it would cause extra work for all people who fetched or pulled master in the meantime) |
- | * if you need to abort or undo a merge attempt, you don't have any local changes that you want to keep and you haven' | + | * if you need to abort or undo a merge attempt |
< | < | ||
git reset --hard ORIG_HEAD | git reset --hard ORIG_HEAD | ||
Line 42: | Line 51: | ||
# if everything is ok and you don't have any rebase conflicts, push the | # if everything is ok and you don't have any rebase conflicts, push the | ||
# changes to the repository master branch | # changes to the repository master branch | ||
- | git push --ff origin my_local_branch: | + | git push origin my_local_branch: |
</ | </ | ||
- | Alternatively you could use a shorter version, by replacing the git fetch and git rebase with git pull --rebase: | + | Alternatively you could use git pull --rebase instead of git rebase: |
< | < | ||
# change to my local branch | # change to my local branch | ||
git checkout my_local_branch | git checkout my_local_branch | ||
+ | git fetch origin | ||
# rebase on the latest origin/ | # rebase on the latest origin/ | ||
git pull --rebase --ff origin master | git pull --rebase --ff origin master | ||
# if everything is ok and you don't have any rebase conflicts, push the | # if everything is ok and you don't have any rebase conflicts, push the | ||
# changes to the repository master branch | # changes to the repository master branch | ||
- | git push --ff origin my_local_branch: | + | git push origin my_local_branch: |
</ | </ |