Boost logo

Boost :

Subject: Re: [boost] [git] Mercurial? easy merging in svn, how about git/hg?
From: Julian Gonggrijp (j.gonggrijp_at_[hidden])
Date: 2012-03-28 16:43:34


Frank Birbacher wrote:

> I feel you didn't try enough of svn: creating a branch and merging it
> back is really a simple thing to do in svn.
>
> cd someemtpydir
> svn co svn://server/svn/trunk .
> # create branch:
> svn cp ^/trunk ^/branches/my-branch -m "branch"
> # edit branch:
> svn switch . ^/branches/my-branch
> echo "new" > new.txt
> svn add new.txt
> svn ci -m "new file"
> # switch back to trunk and merge:
> svn switch ^/trunk .
> svn merge ^/branches/my-branch .
> # revise working copy before commit, or revert and try again
> # svn revert -R .
> svn ci -m "merged branch"
>
> So how would that go with git or hg? Would it be easier?

In git (assuming that you configured aliases "co" and "ci"):

git clone ssh://user@server:projectname.git
cd projectname
# create and switch to a branch:
git co -b branch
# edit branch:
echo "new" > new.txt
git add new.txt
git ci -m "new file"
# switch back to develop and merge+commit:
git co develop
git merge branch
# update from server
git pull
# any conflict resolution here
# publish your work
git push

Same number of commands in total, but you need to type less on
average in git, especially for the branching operations. Apart from
that, committing, forking, switching and merging will all be
significantly faster in git.

-Julian


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk