鍍金池/ 教程/ Java/ 第31關(guān) branch
第13關(guān) stash
第37關(guān) push_branch
附錄A Git 學習資源
第54關(guān) submodule
第15關(guān) restructure
第18關(guān) push_tags
第17關(guān) tag
前言
第22關(guān) reset_soft
Githug 安裝和使用方法
第41關(guān) repack
第16關(guān) log
第7關(guān) ignore
第10關(guān) number_of_files_committed
第29關(guān) diff
第1關(guān) init
第4關(guān) commit
第33關(guān) checkout_tag
第20關(guān) commit_in_future
第14關(guān) rename
第39關(guān) fetch
第9關(guān) status
第11關(guān) rm
第27關(guān) remote_add
第3關(guān) add
第24關(guān) remote
第26關(guān) pull
第44關(guān) rename_commit
第23關(guān) checkout_file
第32關(guān) checkout
第55關(guān) contribute
第47關(guān) reorder
關(guān)卡列表
第35關(guān) branch_at
第5關(guān) clone
第45關(guān) squash
第43關(guān) grep
第36關(guān) delete_branch
第53關(guān) conflict
第34關(guān) checkout_tag_over_branch
第42關(guān) cherry-pick
第19關(guān) commit_amend
Githug 通關(guān)攻略
附錄C Vim 常用命令
第48關(guān) bisect
第46關(guān) merge_squash
第2關(guān) config
附錄B Linux 常用命令
第21關(guān) reset
第50關(guān) find_old_branch
第12關(guān) rm_cached
第8關(guān) include
第31關(guān) branch
第49關(guān) stage_lines
第30關(guān) blame
第52關(guān) restore
第51關(guān) revert
第28關(guān) push
第25關(guān) remote_url
第40關(guān) rebase
第38關(guān) merge
第6關(guān) clone_to_folder

第31關(guān) branch

You want to work on a piece of code that has the potential to break things, create the branch test_code.

你想要修改一處代碼,在修改過程中可能會引起一些問題,所以要創(chuàng)建一個分支 test_code 來修改。

接下來的10關(guān)都和分支有關(guān)。 如果你想在不影響主線的情況下進行安全的開發(fā),就要以主線為基礎(chǔ)創(chuàng)建一個分支,然后在分支上修改,最后再把分支合并到主線上。實際上,一般情況下都是在分支上工作的,因為在一個團隊中,你和你的伙伴共享主線,直接在主線下工作會影響其他人,所以每個人都分別在各自的分支上工作。

分支的常用命令如下:

$ git branch branch-name
$ git branch

第1條語句用于創(chuàng)建分支,branch-name 就是你要創(chuàng)建的分支名稱;第2條語句用于列出全部分支。

第31關(guān)過關(guān)畫面如下:

http://wiki.jikexueyuan.com/project/githug-walkthrough/images/level-31-branch.png" alt="第31關(guān) branch" />