2017-03-21 40 views
0

我下面這個tutorial,我感到困惑的快進合併例子,它具有以下功能:`git checkout -b新功能主控程序是做什麼的?

# Start a new feature 
git checkout -b new-feature master 
# Edit some files 
git add <file> 
git commit -m "Start a feature" 
# Edit some files 
git add <file> 
git commit -m "Finish a feature" 
# Merge in the new-feature branch 
git checkout master 
git merge new-feature 
git branch -d new-feature 

什麼是第二行嗎?與git checkout -b new-feature有什麼不同?

回答

1

命令

git checkout -b new-feature master 

將創建一個新的分支稱爲new-feature mastermaster也籤新的分支。

檢查documentation的詳細資料:

git checkout -b|-B <new_branch> [<start point>] 

如果省略<start point>,則當前分支被用作起始點。

+0

哦,我以爲master是git的第四個參數。相反,「新功能大師」是第三位。 – jeff

+1

@jeff:不,你是對的,'master'是一個單獨的(第四個)參數,'new-feature'是第三個參數。這只是新分支的一個可選起點。如果你省略了第四個參數,Git使用'HEAD'作爲起點。 – torek

+0

@torek謝謝,所以它會從'master'創建一個名爲'new-feature'的新分支。 – jeff

相關問題