推送远程分支为默认本地当前分支

1,100 阅读1分钟

☁  crm [hotfix/20190923-houliming-test-push-default] ⚡  gaa
☁  crm [hotfix/20190923-houliming-test-push-default] ⚡  gc '测试默认推送远程'
[hotfix/20190923-houliming-test-push-default 4609b077] 测试默认推送远程
 1 file changed, 1 insertion(+), 1 deletion(-)
☁  crm [hotfix/20190923-houliming-test-push-default] gpush
fatal: 当前分支 hotfix/20190923-houliming-test-push-default 没有对应的上游分支。
为推送当前分支并建立与远程上游的跟踪,使用
git push --set-upstream origin hotfix/20190923-houliming-test-push-default

我设置了一些快捷键,一般推送分支就是这样的流程,一般会让你输入下面哪一行代码

git push --set-upstream origin hotfix/20190923-houliming-test-push-default

但是每次有新分支,都要这样。很是麻烦,

可以设置每一次推送到远程分支为当前的分支

☁ config --global push.default current

☁  crm [hotfix/20190923-houliming-test-push-default] gpush
枚举对象: 13, 完成.
对象计数中: 100% (13/13), 完成.
使用 4 个线程进行压缩
压缩对象中: 100% (7/7), 完成.
写入对象中: 100% (7/7), 591 字节 | 591.00 KiB/s, 完成.
总共 7 (差异 6),复用 0 (差异 0)
remote:
remote: To create a merge request for hotfix/20190923-houliming-test-push-default, visit:
remote:
 * [new branch]        hotfix/20190923-houliming-test-push-default -> hotfix/20190923-houliming-test-push-default

这样就默认推上去了,

参考;www.cnblogs.com/x_wukong/p/…