git 问题:There is no tracking information for the current branch. Please specify which branch you want

Question screenshot

Insert picture description here

Problem description : The current pullobject does not have tracking information for remote branches;

Oral explanation : You 创建的这个分支have not established contact with the 远程仓库middle 其他分支or the mastercurrent branch, so the pull operation cannot be performed on the current branch;

Solution : git branch --set-upstream-to=origin/remote_name local_name


annotation:

remote_name: Remote branch name // Here is the name of the branch you create that needs to be associated with the existing branch
local_name: Local branch // The name of the local branch you are currently creating

Problem extension: The function of the git pull command is to get the data of a remote branch or master and merge it with the local branch. Generally speaking, there are two common situations in git pull: 1 is a remote warehouse with one master, 2 is a remote warehouse with multiple branches, please see:

  1. The remote warehouse is a master: in this case, git pull origin master is generally performed directly;
  2. When the remote warehouse has multiple branches: here you need to specify a remote branch for the local current branch to associate, git branch --set-upstream-to=origin/remote_name local_name
  3. Others: If we use pull under a specific branch, we can git pull origin local_namesimplify the original to git pull, that is, it is no longer necessary to write all git command formats.

Successful screenshot

Insert picture description here

Guess you like

Origin blog.csdn.net/m0_46442996/article/details/111722481
Recommended