0

I thought my branch was based off the remote master but apparently, I just have a local branch that's not really connected. How does one merge this with REMOTE master at this point? Whats the best option when you discover your branch is really just a local branch but you've done a ton of work in it? I think it is based correctly off the right commit in master but its purely a local branch.

2 Answers2

0

All local branches are "purely local branches" you can set a remote branch as tracking branch. But this only means that rebases, merges, pulls and probably pushes (depending on the settings) are working by default on that branch if you do not specify something explicitly. But you can at any time set the remote tracking branch, e. g. with -u to various commands like branch or push. And you can also at any time simply specify explicitly from where you want to rebase, merge, pull or to where you want to push.

Vampire
  • 31,050
  • 2
  • 58
  • 88
0

You have to tell git which remote branch to track against your local branch. As pointed out by Björn, you can use the -u while creating the branch or pushing it for the first time.

Alternatively: you can explicitly set the remote branch to track by the command:

git branch --set-upstream-to origin/my_branch

To understand why and get more details, check out these questions: Why do I need to do `--set-upstream` all the time? and Make an existing Git branch track a remote branch?

Community
  • 1
  • 1
dubes
  • 4,504
  • 3
  • 31
  • 43