Git Learning Part II

file status life circle

basic:

modified:

 

Examples:

 untracked:

unmodified: 

modified:

Git branching ( $ git branch  : view all the branches)

create a branch : $ git branch <branch name>

switching from branch to branch :  $ git checkout <branch name>

moving in the previous branch : $ git checkout -

switching to a branch while creating it : $ git checkout -b <new branch's name>

merge branches :

$ git merge <branch to merge> :merge branch to current branch

$ git merge <branch1> <branch2> : merge b1、b2 into current branch

delete a branch :  $ git branch -d <branch's name> 

Avoid two things:

1. Working hard on the same files on different branches.

2. Rarely merge branches

View the history  

$ git log

原文地址:https://www.cnblogs.com/luiyuying/p/9416486.html