第1步
创建并切换到一个新的“dev”分支,您的本地 git 文件与远程同步,但“dev”分支尚不存在。
git branch dev # create
git checkout dev # switch
# No need to git add or git commit, the current
# branch's files will be cloned to the new branch by-default.
git push --set-upstream origin dev # push the "dev" branch to the remote.
第2步
对“dev”分支进行更改(如果您按照步骤 1 进行更改,则为当前分支),提交并将它们推送到远程“dev”分支。
git add .
git commit -S -m "my first commit to the dev branch" # remove the -S if you're not "secure", secure = when you already setup crypto private and public keys (i.e "verified" green sign in github)
git push -u origin dev # push the changes to the remote, -u origin dev is optional but good to use.
第 3 步
将你的“dev”分支合并到“master”中。
git checkout dev # switch to "dev" branch if you're not already.
git merge master # optionally, this command is being used to resolve any conflicts if you pushed any changes to your "master" but "dev" doesn't have that commit.
git checkout master # switch to "master", which is the branch you want to be merged.
git merge --no-ff dev # merge the "dev" branch into the "master" one.