12. Branch Management Scenarios
When working together, it takes a long time to optimize the code x, which can affect the use of the whole code before it is completed. So the finished code can not be submitted to the repository, the submission will affect others to use the overall code. You lose Git's version management feature without committing.
Then you need to branch and branch out the code you're modifying, and others won't see it. And you work on your own branch, and then you end up merging into the original branch.
13. Create and Merge Branches
13.1. Scene
In Git, versioning is a pointer. Each branch has a dedicated pointer. There is also a head pointer pointing to the main version. When implemented, the head pointer actually points to the branch pointer, The branch pointer then points to the branch. Each time a commit is the equivalent of a new branch version. But the different versions of a branch have only one branch pointer.
Creating a new branch is essentially creating a new branch pointer x and pointing the head to the branch pointer so that your changes are on this branch without affecting the modification of major version A.
Merge the branch x with the original version A after the modification is complete
13.2. Create a new branch
$ git checkout-'dev'dev '
13.3. View all branches (where * corresponds to the current version of Head pointing
$ git Branch* Dev master
When the file is modified, the add commit modifies the new version of the Dev branch. does not affect master
13.4. Switch branches
' Master '
Turning the current branch into a Master,dev still exists
13.5 Merging dev with master
$ git merge devupdating D17efd8. Fec145afast-| 1 1 file 1 insertion (+)
Merges Dev with the repository that the current head points to. Visually this merger is the most recent selection of two branches.
13.6. Delete a branch
$ git branch-d devdeleted Branch Dev (was fec145a).
14.
Git tutorial Learning (iv)