This is an old revision of the document!
GIT push into master howto
This howto assumes you did some local changes into your local master branch, you have commited them and now you want to publish them in the public repository. It assumes that you start in your local master branch (git checkout master). If you want to pushd some changes you did in some other local branch, skip to the next section.
- first try a push directly (1)
$ git push origin master:master
- if it did succeed, then you're done. However if you get back and error like (2):
To ssh://git.sip-router.org/sip-router ! [rejected] master -> master (non-fast forward) error: failed to push some refs to 'ssh://git.sip-router.org/sip-router'
it means that your local branch version is not anymore up-to-date with what's on the public repository. In this case do a rebase (3):
$ git pull --ff --rebase origin master
- if you get something like:
remote: Counting objects: 370, done. remote: Compressing objects: 100% (125/125), done. remote: Total 264 (delta 235), reused 140 (delta 139) Receiving objects: 100% (264/264), 35.32 KiB, done. Resolving deltas: 100% (235/235), completed with 101 local objects. From ssh://git.sip-router.org/sip-router * branch master -> FETCH_HEAD First, rewinding head to replay your work on top of it... Applying: perl(k): fixed makefile
everything went ok and you only need to retry the push:
$ git push origin master:master Counting objects: 9, done. Delta compression using 2 threads. Compressing objects: 100% (5/5), done. Writing objects: 100% (5/5), 515 bytes, done. Total 5 (delta 4), reused 0 (delta 0) Mailing notify to sr-dev@lists.sip-router.org commit_notice master, bd3e028334907c3622e1537d337a9938ed355060 To ssh://git.sip-router.org/sip-router 4568924..bd3e028 master -> master
* if you get a merge conflict then fix-it and proceed as instructed (edit the file with the conflict, use git add <filename> and then git rebase –continue).
NOTE: you could update your branch (3) also with git pull –ff (no –rebase), but then a confusing merge commit message will be recorded, so it's highly recommended to use the –rebase method above.