Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I hide the "pr" remote branches?

Tags:

git

branch

github

I have GitHub for Windows installed. When I run "git branch -a", it shows many remote tracking branches, and they appear to be pull requests.

One co-worker who uses Git for Windows doesn't see this, but another co-worker who also uses GitHub for Windows sees the same result.

Example: I forked "bootstrap-sass". On github.com, I used the "Clone in desktop" button. It opens GitHub for Windows, and adds the new repo to my list of local repos.

Running "git branch -a", it returns over 100 results, most of them are "/pr/#". Below is a small sample:

C:\gh-ui\bootstrap-sass [master]> git branch -a
  bower
* master
  remotes/kenshub/2.0-stable
  remotes/kenshub/2.1-stable
  remotes/kenshub/HEAD -> kenshub/master
  remotes/kenshub/gh-pages
  remotes/kenshub/master
  remotes/kenshub/next
  remotes/origin/bower
  remotes/origin/master
  remotes/origin/pr/3
  remotes/origin/pr/4
  remotes/twbs/2.0-stable
  remotes/twbs/2.1-stable
  remotes/twbs/gh-pages
  remotes/twbs/master
  remotes/twbs/next
  remotes/twbs/pr/1
  remotes/twbs/pr/10
  remotes/twbs/pr/103

I'm guessing it's GitHub for Windows. How can I hide the "pr" remote branches? Is it a git config, or part of the "Clone in desktop" command?

like image 879
yazzer Avatar asked Apr 12 '26 11:04

yazzer


1 Answers

When cloning a repo, don't use the "Clone in Desktop" option if you have GitHub for Windows installed. Instead, copy the clone URL and run git clone <url> through command line.

When you clone through GitHub for Windows, it is running extra commands like:

fetch origin +refs/pull/*/head:refs/remotes/origin/pr/* +refs/heads/*:refs/remotes/origin/* --prune
status --untracked-files=all --porcelain -z

If you don't want to re-clone the repo, then refer to the other answer about deleting branches, and make sure you don't have a fetch refs congif to get "/pr/" branches. View your .git/config file, or run git config --list --local.

like image 196
yazzer Avatar answered Apr 15 '26 01:04

yazzer