0

When using Git for source control, what are the benefits of using feature branches over just committing to the "develop" branch?

user229044
  • 232,980
  • 40
  • 330
  • 338
Lea Hayes
  • 62,536
  • 16
  • 62
  • 111

3 Answers3

3

Very short answer

It's a mechanism of maintaining code stability; if you and I are on a team; and you want to add a feature; while I am trying to debug an existing problem; I don't want you to commit into the current develop branch and throwing off my base;

Detailed Discussion

There is a nice overview of this at http://nvie.com/posts/a-successful-git-branching-model/

Have a read.

Ahmed Masud
  • 21,655
  • 3
  • 33
  • 58
  • In your opinion do you prefer to use `--no-ff` when merging feature branches back into develop? SourceTree doesn't seem to provide this option in its Git Flow GUI, but I could do this using command line if this is a better practice. – Lea Hayes May 06 '13 at 20:01
  • A very detailed answer is given here http://stackoverflow.com/questions/9069061/what-is-the-difference-between-git-merge-and-git-merge-no-ff – Ahmed Masud May 06 '13 at 23:43
1

There are several benefits, I'll give you two of the biggest

  1. You can work on several features and switch between the two until they are finish or discarded. If discarded all traces if them will be removed.
  2. You can commit "dirty" states on your local feature branch and then squash them together to form one commit for the entire feature on to the master/devel branch.
user229044
  • 232,980
  • 40
  • 330
  • 338
Andreas Wederbrand
  • 38,065
  • 11
  • 68
  • 78
0

These kind of separation prevents some confusions between versions. More than one working space provides you more flexible environment while you are working on two or more different features or bugs at the same time.

You can check this link for better strategy :

http://nvie.com/posts/a-successful-git-branching-model/

Fuat Coşkun
  • 1,045
  • 8
  • 18