Git - 使用 master 分支中的所有内容创建一个新分支

Git - Create a new branch with all the content from the master branch

假设我到目前为止只在 master 上工作并且已经将所有提交推送到 github.com 上的 master 分支。用 master 中的所有内容创建一个 testing(在这个特定时间点)就这么简单吗?

$ git checkout -b testing
$ git add *
$ git push origin testing

是的,正如 RomainValeri 所说,没有必要 git add * 要创建测试分支,如果您在主分支中:

git checkout -b testing

将您的修改推送到分支测试:

git add -A
git commit -m "Some message"
git push origin testing

然后,如果您想要将测试中的内容合并到 master 分支:

git checkout master
git merge testing