`git checkout -b new-feature master` 有什么作用?
What does `git checkout -b new-feature master` do?
我正在关注这个 tutorial 并且我对快进合并示例感到困惑,它执行以下操作:
# 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
有何不同?
命令
git checkout -b new-feature master
将从 master
创建一个名为 new-feature master
的新分支 并且 也检查该新分支。
查看 documentation 了解更多信息:
git checkout -b|-B <new_branch> [<start point>]
如果省略<start point>
,则以当前分支为起点。
我正在关注这个 tutorial 并且我对快进合并示例感到困惑,它执行以下操作:
# 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
有何不同?
命令
git checkout -b new-feature master
将从 master
创建一个名为 new-feature master
的新分支 并且 也检查该新分支。
查看 documentation 了解更多信息:
git checkout -b|-B <new_branch> [<start point>]
如果省略<start point>
,则以当前分支为起点。