git命令指定默认分支_Git设置默认的push分支

Git设置默认的push分支

Git缺省情况下并没有什么默认的推送的分支,如果你执行

$> git push

warning: push.default is unset; its implicit value is changing in

Git 2.0 from ‘matching’ to ‘simple’. To squelch this message

and maintain the current behavior after the default changes, use:

git config –global push.default matching

To squelch this message and adopt the new behavior now, use:

git config –global push.default simple

See ‘git help config’ and search for ‘push.default’ for further information.

(the ‘simple’ mode was introduced in Git 1.7.11. Use the similar mode

‘current’ instead of ‘simple’ if you sometimes use older versions of Git)

Everything up-to-date

就会告诉你给一个警告!

所以如果你即使要推送当前对应分支,你还是要告诉git,例如当前是myBranch,要推送的话,

$> git push origin myBranch

为了简化这个命令,也就是当我们输入

$> git push

让git直接推送到本branch就好

要做到这一点,就需要告诉默认的推送目的branch,这个需要是动态的,不然当我们checkout到别的branch,就会有问题。git为我们提供了这个功能,就是直接设置默认的推送branch为current

$> git config –global push.default current

再用下面的命令查看我们设置的值

$> git config –global push.default

current

看到了了吧,输出我们刚才设置的值, current

接下来,直接执行

$> git push

看看效果吧

版权所有,禁止转载. 如需转载,请先征得博主的同意,并且表明文章出处,否则 按侵权处理.

分享到:

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值