将提交推送到本地分支,而不是远程。

huangapple go评论54阅读模式
英文:

Push commits to local branch only not remote

问题

我在Bitbucket上有一个项目,我在本地克隆了它。当我切换到一个分支来开展一个新功能时,我希望我的提交只在本地功能分支上可用,然后在一切准备就绪时,将所有提交从本地分支推送到远程分支。

目前,当我使用git push将提交推送到本地分支时,Git总是会抱怨这次推送,显示使用 git push --set-upstream <远程分支>,然后退出。

如何实现这一目标?

英文:

I have a project on bitbucket the I cloned locally. when I checkout a branch to work on a feature I want my commits to be available on the local feature branch ONLY then when everything is good to go, push all commits from local branch to remote one.

Currently when I push commits to the local branch using git push git always complains about this push, shows a use git push --set-upstream &lt;remote branch&gt; and exits.

How can I achieve this?

答案1

得分: 1

所以你不需要推送。当你提交你的代码时,它会将你更新的代码存储在本地,不会将其发送到任何远程。

英文:

So you don't need to push. When you commit your code it stores your updated code locally and will not send it to any remote.

huangapple
  • 本文由 发表于 2023年3月7日 18:49:27
  • 转载请务必保留本文链接:https://go.coder-hub.com/75661023.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定