Creating a branch
git branch branch name
Switching branch
git checkout branch name
Merge branch
git merge branch name
About Merge Conflict explanation:
The so-called conflict, but nothing more than the existence of the same name but different contents of files like two branches, Git does not know which one you want to give up or keep which one, so you need to decide. Run the git status command shows you need to resolve the conflict
Deleted branches
git branch -d branch name
Because Git branch principle is really just recorded through a pointer, so create and delete branches are almost instantaneous.
Note: If you try to delete unincorporated branch, Git will prompt you to "The branch is not fully merged, if you want to delete, use git branch -D branch name command.
About anonymous branch
This occurs when:
1. Create three files and in turn submitted (each create a document submitted once)
We know the branch command to create a branch, and then use the checkout command to switch branches.
If the checkout command execution in the case did not create a branch, what will happen then? Checkout execute git the HEAD ~ command:
HEAD pointer of the current state of separation, you can look around and do some experimental changes and submit them, and you can discard any submission you make in this state, without affecting any branch practice is to perform checkout command to switch back other branches.
If you want to create a new branch, and keep what you do submit created, you can (now or later) by using with the realization checkout command with the -b option. E.g:
git checkout -b <new-branch-name>
HEAD pointer is currently pointing 52861cf ... 2.txt
That generally means:
Uh, people say the word is: you use the checkout command without specifying a branch name, so Git help you create an anonymous branch, OK, since it is anonymous, then when you switch to another branch, this branch of all anonymous submission will be discarded (because you did not give people a name, anyway, brought back after all, do not lose doing?). Therefore, you can use an anonymous branch to do an experiment or something, anyway, will not have a negative impact.