Git Learning Part II - Working locally

 

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

 

posted on 2018-08-23 16:27  洛小侠  阅读(252)  评论(0编辑  收藏  举报

导航