Recently I started using gh
for working with my forks. Before that I used to add the remotes manually.
When cloning a fork, gh
adds the original repository as a upstream
remote which is what I used to do manually, but if you try to find the branches, you'll find that it only tracks the default one.
For tracking all of the branches in the upstream
remote too, you just need to find the fetch
line under the upstream
section in the .git/config
file.
For example, this is the content of my .git/config
after cloning my go
fork:
$ cat .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = git@github.com:alexsaezm/go.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[remote "upstream"]
url = git@github.com:golang/go.git
fetch = +refs/heads/master:refs/remotes/upstream/master
But what I really want under the upstream
entry is this:
[remote "upstream"]
url = git@github.com:golang/go.git
fetch = +refs/heads/*:refs/remotes/upstream/*
After changing that file, you can do a git fetch --all
:)
Top comments (0)