Sublime Forum

How to Checkout Branch and Track Remote

#1

Hi,

This is probably a silly question, but how do I check out a remote branch locally for the first time? I pulled the repo and can see the branch in the commit history, but I can’t change to it using ‘Checkout Branch’ as it’s not in the list.

I also tried ‘Checkout Remote Branch’ but it doesn’t create it locally.

Thanks!

0 Likes

#2

There’s a context menu entry for “Create local branch from origin/foo” that will do this

0 Likes

#3

We can’t set a remote branch though, can we? Or, like, when we create a new branch create it while pushing? Had to use command line for this.

0 Likes

#4

That option did the trick, thanks jps!

0 Likes

#5

This was very confusing to me and I had to drop to the command line to fix it.

I create a new local branch, committed changes and then pushed it to the remote. But it didn’t start tracking it. I could see no way in Sublime Merge to track it. I had to drop to the command line and run
git branch -u origin/branch_name

Am I missing the sublime merge command that can add tracking to an already existing local and remote branch?

0 Likes

#6

The -u option is short for --set-upstream-to=<upstream>, therefore:

  • right click the branch/commit and pick Set Upstream...
  • or with the command palette: Set Branch Upstream

It should have, are you sure you didn’t hide the remote branches & therefore didn’t see the newly created & pushed remote branch?

0 Likes