Github: Display remote-tracking branches in branch list

Created on 2 Nov 2016  ยท  18Comments  ยท  Source: atom/github

Currently if the user fetches all remote branches, there is no way to checkout a newly-fetch branch.

For example, imagine a branch foo exists on the remote but you don't have it locally.

โžœ  git fetch
From https://github.com/kuychaco/test-repo
 * [new branch]      foo      -> origin/foo

git branch will not show it as a local branch until you type either git branch foo or git checkout foo

Right now we are populating the branches select list by using the output to git branch. To include branches that the user can check out that they have fetched, we should perhaps also display output from git branch --remotes

  origin/my-branch
  origin/HEAD -> origin/master
  origin/foo
  origin/qux
branching

Most helpful comment

Short term

There is the <optgroup> element to group options. So in the dropdown we could have two groups, local and remote:

screen shot 2017-02-11 at 11 01 51 am

<select class="github-BranchMenuView-item github-BranchMenuView-select input-select">
  <optgroup label="Remote Branches">
    <option value="master">master</option>
    <option value="new-pr">new-pr</option>
  </optgroup>
  <optgroup label="Local Branches">
    <option value="master">master</option>
    <option value="new-branch">new-branch</option>
    <option value="shadow-doom">shadow-doom</option>
    <option value="sm-test-2">sm-test-2</option>
    <option value="sm-test-3">sm-test-3</option>
  </optgroup>
</select>

A huge list could be ugly.

Yup, atom/atom has 79 remote branches. :see_no_evil: Just show active branches? Or capped to the 15-20 most recent?

Long term

UI that allows you to do a search of remote/local branches

@kuychaco had something in mind similar to GitHub Desktop. Also requested in ๐Ÿ‘‰ https://github.com/atom/github/issues/293.

What about 2 lists ( ๐Ÿค” sounds familiar ) that individually scroll:

_branch

But are also collapsible. Then you can close one if you want more space for the other:

_branch 4


Another idea is to initially have the current branch already as value in the input and selected (but not actually do the filtering):

_branch 2

Then you could do the following:

  • Just start typing: Starts to filter with new name

    • If the name can't be found, the [Checkout] button switches to [Create], hitting enter creates a new branch.

  • Hit right arrow + backspace (maybe multiple times): Now it filters with branches that start with the same name.
  • Hit right arrow and start typing: Now you can create a new branch starting with the same name. Like branch -> branch2. Handy to quickly test out something.

_branch 3

Also, should there be an option to sort the lists? Maybe:

  • Alphabetically
  • By activity (sort by most recent commits)
  • Or also by most recently checked out. That might be handy to quickly keep toggling between two branches because they appear at the top.

And at some point we can also start considering other features, like:

  • Rename a branch
  • Delete a branch
  • Merge two local branches
  • Change tracking (point to another remote branch)
  • Add multiple remotes
  • Show tags
  • more?

All 18 comments

+1 for this!

/cc @simurai We were wondering if you could help us with the UX on this. A huge list could be ugly.

Intellij has a dropdown that looks like this(it can get huge if there's a lot of branches):
image

I wonder if we could create some UI that allows you to do a search of remote/local branches

github Desktop has the following:

image

Short term

There is the <optgroup> element to group options. So in the dropdown we could have two groups, local and remote:

screen shot 2017-02-11 at 11 01 51 am

<select class="github-BranchMenuView-item github-BranchMenuView-select input-select">
  <optgroup label="Remote Branches">
    <option value="master">master</option>
    <option value="new-pr">new-pr</option>
  </optgroup>
  <optgroup label="Local Branches">
    <option value="master">master</option>
    <option value="new-branch">new-branch</option>
    <option value="shadow-doom">shadow-doom</option>
    <option value="sm-test-2">sm-test-2</option>
    <option value="sm-test-3">sm-test-3</option>
  </optgroup>
</select>

A huge list could be ugly.

Yup, atom/atom has 79 remote branches. :see_no_evil: Just show active branches? Or capped to the 15-20 most recent?

Long term

UI that allows you to do a search of remote/local branches

@kuychaco had something in mind similar to GitHub Desktop. Also requested in ๐Ÿ‘‰ https://github.com/atom/github/issues/293.

What about 2 lists ( ๐Ÿค” sounds familiar ) that individually scroll:

_branch

But are also collapsible. Then you can close one if you want more space for the other:

_branch 4


Another idea is to initially have the current branch already as value in the input and selected (but not actually do the filtering):

_branch 2

Then you could do the following:

  • Just start typing: Starts to filter with new name

    • If the name can't be found, the [Checkout] button switches to [Create], hitting enter creates a new branch.

  • Hit right arrow + backspace (maybe multiple times): Now it filters with branches that start with the same name.
  • Hit right arrow and start typing: Now you can create a new branch starting with the same name. Like branch -> branch2. Handy to quickly test out something.

_branch 3

Also, should there be an option to sort the lists? Maybe:

  • Alphabetically
  • By activity (sort by most recent commits)
  • Or also by most recently checked out. That might be handy to quickly keep toggling between two branches because they appear at the top.

And at some point we can also start considering other features, like:

  • Rename a branch
  • Delete a branch
  • Merge two local branches
  • Change tracking (point to another remote branch)
  • Add multiple remotes
  • Show tags
  • more?

+1

+1 not having remote branches is a major limitation

+1 How's this going?

+1

Is this feature still wip?

+1

+1

+1

+1

For those of you simply posting "+1": it will do _far_ more for this issue to add your votes to the initial post.

has this been remedied? is there a beta I can get at?

@Byoung730 This issue is still open, so it hasn't been resolved yet ๐Ÿ˜‰.

You should follow https://github.com/atom/github/pull/1370 as it's likely the implementation of that RFC will resolve this.

For the UI of this, I'd really like to see the remote named if it's not origin. In all the UI examples above, we're treating all remote branches the same. However, origin/master and upstream/master are two very different branches, and we'd want to make sure we don't mix those up.

God I need this

It's been more than 3 years I'm waiting for this, because the integration between atom and github is really great !
Any update about this issue (or an extension/ctrl shift P command that would allow checkout to remote branchs as simple as the git cli) ?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jingr1 picture jingr1  ยท  4Comments

rsese picture rsese  ยท  4Comments

jazeee picture jazeee  ยท  3Comments

danielbayley picture danielbayley  ยท  5Comments

move[bot] picture move[bot]  ยท  3Comments