問題:
$ git fetch
$ git merge
Now I get the error:
fatal: No commit specified and merge.defaultToUpstream not set.
解決辦法:
Usually you do not invoke
without arguments (at least I don't know anyone who does). If you want that
git merge
defaults to the tracking branch, you need to set
merge
to true:
merge.defaultToUpstream
. Your
git config merge.defaultToUpstream true
branch has to track
master
in this case:
origin/master
. This is done automagically if
git branch --set-upstream master origin/master
origin/master
was already present when you cloned.
Personally, I do
and then
git fetch
or
git merge origin/master
git pull
if I have no local commits.
git merge後面需要跟參數,指明是跟的merge的哪個 branch,如git merge origin/master。