I am curious how git knows that branch is up to date if it complaints about lack of tracking information for this branch?
git pull -v --rebase=merges
POST git-upload-pack (155 bytes)
From https://github.com/org/repo
= [up to date] PLTFM-541_POSTGRES_PASSWORD_is_leaked -> origin/PLTFM-541_POSTGRES_PASSWORD_is_leaked
There is no tracking information for the current branch.
Please specify which branch you want to rebase against.
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=<remote>/<branch> PLTFM-541_POSTGRES_PASSWORD_is_leaked
From the output above we can see that my branch was bound to origin repo:
PLTFM-541_POSTGRES_PASSWORD_is_leaked -> origin/PLTFM-541_POSTGRES_PASSWORD_is_leaked
But from the next message below we see that it does not:
If you wish to set tracking information for this branch you can do so with
It does not - as you correctly wrote. You are misunderstanding the output of git.
No, that is a misunderstanding. The full output is:
This output is only printed because you used
git pull -v- it would not be printed without the-v. This output simply informs you that:This says nothing about your local branch "PLTFM-541_POSTGRES_PASSWORD_is_leaked", even though this local branch has the same name as the remote branch.
The crucial thing to understand is:
Git has local branches and remote-tracking branches. Both branches are actually stored in your local repository (so both are local in a sense), but they are still different.
However, you can "link" a local branch to a remote-tracking branch by setting a remote-tracking branch as the so-called "upstream branch" or "tracking branch" of a local branch. This is what the command
git branch --set-upstream-to=...does, and what happens by default to the "master" branch when you clone a repository.You can see this "tracking information" in the output of e.g. "git branch -vv":
Here, you have three local branches: "feature/do-stuff", "master", "mylocalbranch". The first two have remote-tracking branches as their tracking/upstream branches (shown in angle brackets), the third has no upstream branch (like in your case).
For more explanation, see e.g. the Git Book, chapter 3.5 Git Branching - Remote Branches