A colleague pushed a new remote branch to origin/dev/homepage and I cannot see it when I run:
$ git branch -r
I still see preexisting remote br
Let's say we are searching for release/1.0.5
When git fetch -all
is not working and that you cannot see the remote branch and git branch -r
not show this specific branch.
1. Print all refs from remote (branches, tags, ...):
git ls-remote origin
Should show you remote branch you are searching for.
e51c80fc0e03abeb2379327d85ceca3ca7bc3ee5 refs/heads/fix/PROJECT-352
179b545ac9dab49f85cecb5aca0d85cec8fb152d refs/heads/fix/PROJECT-5
e850a29846ee1ecc9561f7717205c5f2d78a992b refs/heads/master
ab4539faa42777bf98fb8785cec654f46f858d2a refs/heads/release/1.0.5
dee135fb65685cec287c99b9d195d92441a60c2d refs/heads/release/1.0.4
36e385cec9b639560d1d8b093034ed16a402c855 refs/heads/release/1.0
d80c1a52012985cec2f191a660341d8b7dd91deb refs/tags/v1.0
The new branch 'release/1.0.5' appears in the output.
2. Force fetching a remote branch:
git fetch origin
$ git fetch origin release/1.0.5:release/1.0.5
remote: Enumerating objects: 385, done.
remote: Counting objects: 100% (313/313), done.
remote: Compressing objects: 100% (160/160), done.
Receiving objects: 100% (231/231), 21.02 KiB | 1.05 MiB/s, done.
Resolving deltas: 100% (98/98), completed with 42 local objects.
From http://git.repo:8080/projects/projectX
* [new branch] release/1.0.5 -> release/1.0.5
Now you have also the refs locally, you checkout (or whatever) this branch.
Job done!