Collaborative development using Git Branch

Source: Internet
Author: User
Tags using git

Collaborative development using Git Branch

In large-scale software project development, the use of multiple branches can not only develop multi-module tasks in parallel, but also avoid introducing new function code During Bug fixes or accidentally deleting the Bug code to fix and reproduce the problem, clearer development of 'Organizational 'projects.

The new branches generally fall into the following three categories: the release Branch (Bugfix Branch), the feature branch, and the seller branch.

 

Install Git on Ubuntu Server

 

Create a Git repository on the server (Ubuntu)

 

Git simple tutorial in Linux (taking Android as an example)

 

Git authoritative guide PDF

 

I. Release Branch

The release branch is mainly used to correct bugs in the Code submitted before, so that the correction process and main line function development can be carried out in parallel.

Ii. Feature branches

Feature branches are mainly used to separate a function module from the Development Main Line, and are suitable for developing function modules with specific features such as long development cycles and experimental features.

Iii. Seller Branch

The so-called seller branch is to create a branch that is synchronized with the upstream in the version library. Once the upstream code is published, it is collected into the seller branch.

 

Regardless of the Branch, the operation process is nothing more than the following steps:

1. Create a branch (1) You can use

Git branch <newbranch>

Switch to the new branch:

Git checkout newbranch

(2) or directly

Git checkout-d newbranch

 

By default, it is directed from the latest commit, that is, HEAD, to submit the creation of branch. This method is generally used as a temporary branch. It accepts the changes and is finally deleted after the master branch is merge.

However, in bug modification or new module development, branch needs to be submitted from history, and the commit id or corresponding tag must be added after the preceding statement.

 

2. Develop on the new branch

Here, you can use git rev-parse to check whether the points of different branches are the same.

The git cherry command can be used to view the current submission ahead of origin.

 

After the development task on the new branch (the development task can be bug fixing or new module development) is completed, you need to merge the submission on the new branch to the master branch, in general, there are three situations:

(1) Use merge

First, create a new branch and complete the work commit. then switch to the master of the master branch and "merge" the branches created in the master branch. As follows:

Figure 1

Note that you must specify the name of the merged branch after merge.

 

(2) Use cherry-pick

Figure 6

Switch to the master branch, and then select the newbranch history submission that needs to be merged to the master branch.

This method differs from method (1) in that you can choose to merge newbranch commit instead of all merge.

For more details, please continue to read the highlights on the next page:

  • 1
  • 2
  • Next Page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.