Search code examples
gitbranchgit-remote

How can I fix git local branch tracking issue?


Hi! recently I had a issue with my local branch ("new-design"), where from months ago it was tracking its remote branch (origin/new-design) perfectly. In this week I realize that my commits wasn't reflecting in this remote branch, also, it changed unexpectly to master remote branch (origin/master).

From this: local/new-design - origin/new-design to this: local/new-design - origin/master

Tracking the repository history I had never opened a pull-request (this whould not change traching branch references) neither changed mannualy this references.

Any ideas about what happened here? And more important, what is the best method (rebate-onto, compare, etc) to move all commits done in master to new-design branch?


Solution

  • First, git branch -avv can show you which branch is tracking which.

    Second, you can change your remote tracking branch with:

    git branch new-design -u origin/new-design