Search code examples
gitgithubgit-pull

git pull no tracking info for my branch after merging a branch from another remote to my branch


There is a repository called main_repo, that me and my colleague forked. So, my colleague created a branch called new_changes on her fork and branched out from my branch called my_branch and made new changes. Yesterday I merged her pull request of her branch to my branch on stash using the merge button.

On her pull request page it says MERGED her_fork_repo new_changes to my_branch in commit 1234.Supposedly if I git pull on my branch on intellij I would see my colleague's new changes, but instead it says:

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=origin/<branch> my_branch

From my branch when I typed git remote it shows origin.I have also tried git pull origin my_branch but git says Already up to date.

And from my_branch 's pull request page (to merge into main_repo), I didn't see the new changes also, what should I do so that the new changes is reflected on my branch?


Solution

  • On her pull request page it says MERGED her_fork_repo new_changes to my_branch in commit 1234

    A PR can be between two branches of the same repository, or between branches of a fork repo and the upstream original repository that was forked.

    If your colleague PR was merged, make sure it where: it it is on the original upstream repository, you would need to add that upstream remote URL to your own local clone in order to be able to fetch "commit 1234".

     cd /path/to/local/clone/of/my/fork
     git remote add upstream https://url/upstream/original/repository
     git fetch upstream
     git merge upstream/my_branch