(1)创建分支

首先你要创建自己的分支

Qt Creator git branch 创建分支/分支切换 git push --set-upstream origin mybranch

填上分支名称,点ok关闭。

Qt Creator git branch 创建分支/分支切换 git push --set-upstream origin mybranch

然后编辑你的代码,并提交。

提交分支时提示如下错误

The command "D:\xxxx\Git\bin\git.exe" terminated with exit code 128.

10:31 Executing in D:\git\xxxxxxx: D:\xxxx\Git\bin\git.exe push

fatal: The current branch mybranch has no upstream branch.

To push the current branch and set the remote as upstream, use

git push --set-upstream origin mybranch

The command "D:\xxxx\Git\bin\git.exe" terminated with exit code 128.

这时候可以根据提示在你的工程目录下点git bash here

Qt Creator git branch 创建分支/分支切换 git push --set-upstream origin mybranch

然后执行:git push --set-upstream origin mybranch(mybranch为你自己的分支名称) 

Qt Creator git branch 创建分支/分支切换 git push --set-upstream origin mybranch

然后你在去push就可以成功了

Qt Creator git branch 创建分支/分支切换 git push --set-upstream origin mybranch

(2)切换分支

如果想切换回主分支时,可以按以下设置

Qt Creator git branch 创建分支/分支切换 git push --set-upstream origin mybranch

Qt Creator git branch 创建分支/分支切换 git push --set-upstream origin mybranch

这样你就可以切换回主分支了。

由于网上找了很久没有找到教程,这些是自己摸索的,可能有不完善或者不对的地方,欢迎大家指出不足或者不对的地方,欢迎留言交流。

 

相关文章: