下面的错误:
1 $ git pull 2 Password: 3 You asked me to pull without telling me which branch you 4 want to merge with, and 'branch.master.merge' in 5 your configuration file does not tell me, either. Please 6 specify which branch you want to use on the command line and 7 try again (e.g. 'git pull <repository> <refspec>'). 8 See git-pull(1) for details. 9 10 If you often merge with the same branch, you may want to 11 use something like the following in your configuration file: 12 13 [branch "deve"] 14 remote = <nickname> 15 merge = <remote-ref> 16 17 [remote "<nickname>"] 18 url = <url> 19 fetch = <refspec> 20 21 See git-config(1) for details.
其中deve是一个分支。切换到这个分支后,执行git pull 会从 ./git/config中执行:
[branch "master"]
remote = origin
merge = refs/heads/master
可是,现在这个配置文件中只有master,所以这个分支会找不到。
只要加进去就行了,执行这两条命令:
1 $ git config branch.master.remote origin 2 $ git config branch.master.merge refs/heads/master
这个样config中就会多出一条
1 [branch "deve"] 2 remote = origin 3 merge = refs/heads/master
这样在git pull ,问题就搞定了!