Thursday, October 25, 2012

Branching with GIT

Yann Esposito compares BZR and GIT Distributed Version Control Systems (Source control).

I like this example of branching and merging for GIT though.

Cheap branching

You always work into the same main directory. For example, you can work on two fix in the same time. Say fix1 require you to work on file1 and fix2to work on file2. You can work in any order on file1 and file2 in themaster branch. And then go to branch fix1, commit file1 into it. Then go to branch fix2 and commit file2 into it. And finally merge the two branchesfix1 and fix2 into master.
> vim file1
> vim file2
> git br fix1
> git add file1 
> git commit -m 'fix1'
> git br fix2
> git add file2
> git commit -m 'fix2'
> git commit master
> git merge fix1
> git merge fix2
And this is great not to worry about working in the good branch and coding in the same time. You just worry about your code and then about the versionning system.
And I use this possibilities a lot. Working with bazaar, I often made the error to begin a change in the bad branch. then I have to copy my modifications, then revert. In short it was tiedous.
This is why I prefer using git on an every day usage. If Bazaar implement the same way of cheap branching than git. I should switch again.

No comments:

Post a Comment