There is no tracking information for the current branch. Please specify which branch you want to

问题重现

本地创建分支后将本地分支提交到远程 git push origin lhs,此时git pull就出现以下错误信息

There is no tracking information for the current branch.
Please specify which branch you want to merge with.

分析

没有找到跟踪信息,请指定要合并的分支,那我们在当前分支合并一下主分支

具体代码

1、合并主分支

git merge main

2、提交本地合并后的代码(main + lhs)分支,同时将本地分支与远端分支建立连接,以后就可以push/pull代码了

git push --set-upstream origin lhs

3、现在就可以拉下来了

git pull
// Already up to date.

Guess you like

Origin blog.csdn.net/Steven_Son/article/details/127276588