在本地新建分支,并push到远程分支后,对本地代码进行修改后,在提交前执行git pull 会报如下错误

There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

git branch --set-upstream-to=origin/<branch> release

产生原因:

  本地新建分支,并push到远程分支后,并没有建立无程分支和本地分支的关联关系

解决方案:

  1. 将本地修改执行Git Stash进行保存

  2. 将本地分支切换到新push的远程分支上并选择覆盖要地分支--此操作建立起了本地和远程分支的关联 (也可以执行 git branch --set-upstream-to=origin/remote_branch  your_branch) 

  3. 执行Git Stash Pop,将修改恢复到当前分支上。

  4. 对当前修改再执行操作时,就一切正常了