git merge错误:“No commit specified and merge.defaultToUpstream not set”

问题:
$ git fetch
$ git merge

Now I get the error:

fatal: No commit specified and merge.defaultToUpstream not set.

解决办法:

Usually you do not invoke git merge without arguments (at least I don't know anyone who does). If you want that merge defaults to the tracking branch, you need to set merge.defaultToUpstream to true: git config merge.defaultToUpstream true. Your master branch has to track origin/master in this case: git branch --set-upstream master origin/master. This is done automagically if origin/master was already present when you cloned.

Personally, I do git fetch and then git merge origin/master or git pull if I have no local commits.

git merge后面需要跟参数,指明是跟的merge的哪个 branch,如git merge origin/master


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值