git push / pull origin [分支]快捷方式?

问题描述 投票:0回答:2

在过去的几个月里,我一直在控制台中使用git,我觉得打字有点太多了。

这是我的流程(假设我在foo分支上):

[ ... working ... ]
git add .
git commit -m "Commit message"
git pull origin foo
git push origin foo

我知道这是世界上最先出现问题之一,但有没有办法在这里减少打字?我可以使用git pullgit push吗? git pushgit push origin foo有什么区别?

git push commit
2个回答
0
投票

实际上不是“快捷方式”,但肯定会减少输入量:

一旦: git push --set-upstream origin foo

然后: git pushgit pull


0
投票

对于git push,您可以配置为使用配置自动推送到与本地同名的远程分支。

git config push.default current

https://git-scm.com/docs/git-config#git-config-pushdefault

对于git pull,您需要将本地分支跟踪分支设置为远程分支。

请参阅https://stackoverflow.com/a/19279975/1433665

© www.soinside.com 2019 - 2024. All rights reserved.