GitHub entry (five) - a branch operation

Branch operations

1 displays a list of branches

$ git branch


2. Create a switch branch

    2.1git checkout -b   branch name

    2.1 switched to the master branch $ git checkout -b master


2. Features branch

Feature branch as the name suggests, is to focus on a single particular feature (theme), in addition to the branch without any job. In the daily development, we tend to create a number of characteristics of the branches, while outside this branch to retain a stable software ready for release. Role stable branch is usually a master play branch  .


Advantages: in the feature branch-based job-specific topics, themes and then complete the master merge branches. Just keep such a development process, we can guarantee the master branch at any time for people to see. As a result, other developers can also safely from master to create a new feature branch branch.


Main branch

The main branch is the branch we just explain the characteristics of origin, but also the combined endpoint. Usually people will use the master branch as the main branch. Trunk and branches have not developed to the half of the code, you can at any time for others to view. Sometimes we need to let the trunk branch is always arranged in a formal environment, sometimes need to use tags Tag create a version and other information, while managing multiple releases. When multiple versions of a release, there are multiple trunk branch.

1. Merge Branches

    1.1 Switch to the master

        $ git checkout -b master

    A merging branches 1.2

        $ Git go --no-ff

    1.3 View branch in chart form

        $ git log --graph





Guess you like

Origin blog.csdn.net/ly853602/article/details/80379803