關于分支的理解就不多說了,說不清
http://blog.csdn.net/xiaoputao0903/article/details/23933589?utm_source=tuicool&utm_medium=referral
http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/001375840038939c291467cc7c747b1810aab2fb8863508000
http://www.ruanyifeng.com/blog/2012/07/git.html
上圖一張
Paste_Image.png
分支命令
查看分支:git branch
創建分支:git branch <name>
切換分支:git checkout <name>
創建+切換分支:git checkout -b <name>
合并某分支到當前分支:git merge <name>
刪除分支:git branch -d <name> / git branch -D <name> (強制刪除)
Paste_Image.png
Paste_Image.png
個人理解:
每個不同分支中的工作區的文件也是不一樣的;
代碼的commit會影響該分支工作區中的文件;
a分支工作區中有a文件,在a分支基礎上創建b分支,那么b分支也會有a文件
b分支工作區中創建文件b,a(父分支)分支工作區中不會有b文件
a(父分支)、b分支合并后,a分支工作區中的文件會被合并