When I'm on master, I only have to type 'git push' to push commits to the remote repo. I wish I could do so when I'm on another branch, without specifying the remote name and the branch name. Like that:
当我在掌握时,我只需要输入'git push'来将提交推送到远程仓库。我希望在我在另一个分支上时可以这样做,而不指定远程名称和分支名称。像那样:
Now: git push origin experimental:origin/experimental
现在:git push origin实验:起源/实验
Need: git push
需要:git push
2 个解决方案
#1
12
You should edit your .git/config
file. There should be already set something like this:
您应该编辑.git / config文件。应该已经设置了这样的东西:
[branch "master"]
remote = origin
merge = refs/heads/master
Simply copy the group and edit according to your needs. For example, you could have:
只需复制组并根据您的需要进行编辑。例如,您可以:
[branch "master"]
remote = origin
merge = refs/heads/master
[branch "experimental"]
remote = origin
merge = refs/heads/experimental
#2
0
Also, have a look at this answer on how to achieve that from the command line.
另外,请看一下如何从命令行实现这个问题的答案。
#1
12
You should edit your .git/config
file. There should be already set something like this:
您应该编辑.git / config文件。应该已经设置了这样的东西:
[branch "master"]
remote = origin
merge = refs/heads/master
Simply copy the group and edit according to your needs. For example, you could have:
只需复制组并根据您的需要进行编辑。例如,您可以:
[branch "master"]
remote = origin
merge = refs/heads/master
[branch "experimental"]
remote = origin
merge = refs/heads/experimental
#2
0
Also, have a look at this answer on how to achieve that from the command line.
另外,请看一下如何从命令行实现这个问题的答案。