如何在git中只将当前分支从本地推送到远程仓库?

时间:2022-06-21 19:29:33

My local repo has 2 branches: master and doing, I only create commits in doing branch and when I finish the project, I merge it to master branch. When I checkout master branch and push to the remote repo, 2 branches are pushed to the remote. How can I push only master branch to remote repo in order that, commits in doing branch are not appear on remote repo?

我的本地仓库有2个分支:master和doing,我只在创建分支时创建提交,当我完成项目时,我将它合并到master分支。当我结帐主分支并推送到远程仓库时,2个分支被推送到远程。我怎样才能将主分支推送到远程仓库,以便在远程仓库中不出现提交分支?

1 个解决方案

#1


2  

You can manually specify which branch to push:

您可以手动指定要推送的分支:

git push origin master

Or you can configure git to always only push the current branch:

或者你可以配置git始终只推送当前分支:

git config --global push.default simple

#1


2  

You can manually specify which branch to push:

您可以手动指定要推送的分支:

git push origin master

Or you can configure git to always only push the current branch:

或者你可以配置git始终只推送当前分支:

git config --global push.default simple