BranchStrategy
Conclusion
In actual development, we should follow several basic principles for branch management:
First of all, the master
branch should be very stable, that is, it is only used to release new versions, and usually cannot work on it;
Where do you work? All work is done on the dev
branch, that is to say, the dev
branch is unstable. At some point, such as when the 1.0
version is released, the dev
branch is merged into the master
, in The master
branch releases the 1.0
version;
Each of you and your friends are working on the dev
branch, everyone has their own branch, and you can merge into the dev
branch from time to time.
So, the teamwork branch looks like this:
Caption
Git
branches are very powerful and should be fully used in team development.
Normally, when merging branches, Git uses the Fast forward
mode if possible, but in this mode, when the branch is deleted, the branch information is lost.
If you want to force disabling Fast forward
mode, Git
will generate a new commit
on merge
, so that branch information can be seen from the branch history.
When merging branches, add the --no-ff
parameter to merge in normal mode. There are branches in the merged history, and it can be seen that the merge has been done, while the fast forward
merge does not show that the merge has been done. .