Git branch

What is a branch?

Suppose that a large project has been launched, but after a period of time, it is found that new functions need to be added, so it cannot be directly developed on the current project for a long time. A new branch needs to be created, and development, debugging and other operations need to be carried out on the branch. After completion, it will be merged into the master branch.

Without branching, the entire iteration cycle of the product will be prolonged as new features are developed. Worse, if users report that your project has a fatal bug and you have to put the development work at hand to fix it, it will take a lot of time and effort, and it will probably crash.

Create a branch

Syntax: git branch name

But at this point the HEAD pointer still points to the main branch, master

Switch branch

Syntax: git checkout branch name

Check to see if the switchover is successful

See the branch

Git log — evilinear — online

Git log –oneline — graph-all

Create and switch to a branch

Git checkout -b branch name

steps

Git checkout release 2: git checkout release 2: git checkout release 2: git checkout release 2: git checkout release 2: git checkout release 2: git checkout release 2: git checkout release 2: git checkout release 2: git checkout release 2: git checkout release 2: git checkout release 2: git checkout release 2: git checkout release Git checkout -b issue66; git checkout -b issue66; git pull release 3 origin issue66