[SR-Dev] git:master: Merge branch 'master' of ssh://jh at git.sip-router.org/sip-router

Andrei Pelinescu-Onciul andrei at iptel.org
Fri Apr 17 11:54:19 CEST 2009


On Apr 17, 2009 at 12:23, Juha Heinanen <jh at tutpro.com> wrote:
> looks like something wens badly wrong.  i tried to push a patch to
> diaplan module, but also something else got done that i don't know
> anything about.
> 
> did this undo something that others had done or what? if so, how to fix
> it?

No, it hasn't done anything bad to the code, it just added a useless
merge message.

What probably happened is that you have --no-ff in your ~/.gitconfig or
.git/config for the master branch and you did:

git pull  ssh://jh@git.sip-router.org/sip-router master

to update your local master version.
However because of the --no-ff, this forced the generation of a merge
message, which later got pushed to the repo when you pushed your
changes.

In general when you update your local branches, either always use
git pull --ff origin <branchname> (e.g. git pull --ff origin master) or
make sure you don't have --no-ff in gitconfig (but using --ff is safer
since it does not depend on your config).

You want to use --no-ff (force generation of a merge message) only when
you merge 2 public branches. For example let's say I want to merge
andrei/foo (which is published on the public repo) with master.
In this case I would do:

git checkout master
git pull --ff origin master # make sure my local master is up-to-date
git pull --no-ff origin andrei/foo # merge andrei/foo forcing a merge
                                   # message
git push origin master:master # publish changes

There is yet another possible case:
you did some changes on your local master branch, but in the mean while
the public master changed (someone else pushed some changes).

In this case you could use pull to update your local copy before
committing, but that would most likely add a merge message (because it
won't be a fast-forward merge). Instead of a git pull, you could use git
rebase:

git fetch origin # get up-to-date version of branches in origin/
git checkout master # make sure you are on your local master branch
git rebase origin/master # rebase your local changes on top of the
                         # origin version
git push origin master:master

This would look much more clean from the history point of view.

I would also recommend to use a different local branch name then master
for bigger changes (e.g. one derived from what your are planning to do).

For example, I do something like:

git fetch origin
git checkout -b tcp_fixes origin/master
# no I am on my newly created local branch tcp_fixes, which tracks
# origin/master

vi ...  # do some changes, & test them
# prepare to commit them on master
git fetch origin
git rebase origin/master # rebase on the latest origin/master version
git push origin HEAD:master

On the public repo the history would look as if I would have worked 
directly on the latest master version.

See also: http://sip-router.org/wiki/git/merge-into-master


Andrei

> 
>  > Module: sip-router
>  > Branch: master
>  > Commit: 2058f9802c7c9f9a53107635c7b181bafdb83c8c
>  > URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=2058f9802c7c9f9a53107635c7b181bafdb83c8c
>  > 
>  > Author: Juha Heinanen <jh at tutpro.com>
>  > Committer: Juha Heinanen <jh at tutpro.com>
>  > Date:   Fri Apr 17 12:17:37 2009 +0300
>  > 
>  > Merge branch 'master' of ssh://jh@git.sip-router.org/sip-router
>  > 
>  > * 'master' of ssh://jh@git.sip-router.org/sip-router:
>  >   parser: added METHOD_PUBLISH
>  >   registrar: included missing lib/kcore/km_ut.h
>  >   textops: added implementation of free_/fixup_regexp_none()
>  >   core: commented prototype of free_/fixup_regexp_none()
>  >   kex: added module documentation
>  >   kex: set dependency on kmi and kcore libs
>  >   kex: new module - kamailio extensions
>  >   libkmi: moved mi core commands to kex module
>  >   mi_fifo: start FIFO listener process using SR interface
>  > 
>  > ---
>  > 
>  > 
>  > 
>  > 
>  > _______________________________________________
>  > sr-dev mailing list
>  > sr-dev at lists.sip-router.org
>  > http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
> 
> _______________________________________________
> sr-dev mailing list
> sr-dev at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev



More information about the sr-dev mailing list