0

I try to pull (just by "git pull") and it does not work with the following error message:

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> mainline_new

I do not understand what this message mean. Git wants to know what branch I want to merge with. Well, I want to merge the remote branch (that is pulled by default) with the local branch which I am currently in.

I guess I do not want to "set tracking" (how can I want something if I do not know what it is). I just want to copy the latest changes from the remote repository into the current branch of my local repository.

Roman
  • 124,451
  • 167
  • 349
  • 456
  • _"how can I want something if I do not know what it is"_ - by reading the error and consulting the manual, of which the latter you should do anyway according to your last couple of questions. **Which** remote branch do you want to merge into your local branch? – CodeCaster Nov 28 '17 at 08:43
  • 1
    Possible duplicate of [Git: Merge a Remote branch locally](https://stackoverflow.com/questions/21651185/git-merge-a-remote-branch-locally) – Roman Marusyk Nov 28 '17 at 08:45
  • What branches do you have in your current set-up? I presume you have `master`, which has a remote of `origin`. If you are on a feature branch, the normal thing to do is to `git checkout master`, then `git pull` to ensure it is up-to-date, then `git checkout your-feature-branch` and then merge in the local mainline, `git merge master`. – halfer Nov 28 '17 at 12:08

1 Answers1

0

"Tracking" means that your local branch is maintaining a relationship with a named remote branch. Note that the name of the remote branch can actually be different from the local branch (i.e. local branch A can be set to pull from remote branch B)

From your use case, I would enable tracking for your local branch.

Edmund Dipple
  • 2,244
  • 17
  • 12