expandedfronts / revisr

Revisr: Git for WordPress
https://revisr.io
GNU General Public License v3.0
195 stars 41 forks source link

Revisr "Remote branches" does not fetch remote branches created elsewhere #97

Open pedrevans opened 8 years ago

pedrevans commented 8 years ago

Click on "Remote branches" shows only remote branches that were pushed from one's own working directory, but not remote branches that were created elsewhere and pushed to the remote repository. It's impossible to get Revisr to show the new remote branches and there doesn't seem to be a workaround.

This is git behaviour. If you just do a git branch -r you don't see all the remote branches. You have to do a git fetch first to get local git to recognise that there are new branches on the remote repository. After that git branch -r works as expected. Revisr needs to do git fetch before git branch -r.

In the example below you can see that the remote branch update_plugins_20160620 doesn't show up before git fetch has been done.

[pete@cracked-it cracked-it]$ git branch -r
  origin/HEAD -> origin/master
  origin/crackedit-test
  origin/master
  origin/new_home_page_template
[pete@cracked-it cracked-it]$ git fetch
From bitbucket.org:cracked-it/cracked-it
   5996f53..520d4c6  master     -> origin/master
 * [new branch]      update_plugins_20160620 -> origin/update_plugins_20160620
[pete@cracked-it cracked-it]$ git branch -r
  origin/HEAD -> origin/master
  origin/crackedit-test
  origin/master
  origin/new_home_page_template
  origin/update_plugins_20160620
mattgrshaw commented 8 years ago

Revisr actually runs git remote update --prune before running git branch -r.

According to the docs, git remote update --prune should be the equivalent of fetching from all remotes, or the same as running git fetch --all --prune, so it's interesting that this isn't working for you.

It might be worth using fetch instead if that resolves the issue. Can you confirm which version of Git this was happening on?

pedrevans commented 8 years ago

Sorry about the late answer, I've been away on holiday and just saw this.

I am using git version 1.7.1.

pedrevans commented 8 years ago

Wow that's pretty old. I'm on an AWS centOS server. In any case I will look into why it's running such an ancient git.