Package: git Version: 1:2.1.4-2.1+deb8u2 When REMOTE contains refs/refs/X but not refs/X git fetch -p REMOTE +refs/X:refs/X alternately creates and deletes the local ref refs/X !
See transcript below. The repo ~/work/testing.git is not important - any existing git tree with a HEAD will do. I just used something convenient which actually had some commits. Ian. mariner:~> cd junk/d mariner:d> mkdir a mariner:d> cd a mariner:a> git init --bare Initialized empty Git repository in /u/iwj/junk/d/a/ mariner:a> git fetch --no-tags ~/work/testing.git HEAD:foo remote: Counting objects: 10892, done. remote: Compressing objects: 100% (4072/4072), done. remote: Total 10892 (delta 7534), reused 9905 (delta 6765) Receiving objects: 100% (10892/10892), 1.96 MiB | 0 bytes/s, done. Resolving deltas: 100% (7534/7534), done. >From /u/iwj/work/testing * [new ref] -> foo mariner:a> git update-ref refs/refs/p foo mariner:a> mkdir ../b mariner:a> cd ../b mariner:b> git init Initialized empty Git repository in /u/iwj/junk/d/b/.git/ mariner:b> git fetch -p ../a +refs/p:refs/p remote: Counting objects: 10892, done. remote: Compressing objects: 100% (3303/3303), done. remote: Total 10892 (delta 7534), reused 10892 (delta 7534) Receiving objects: 100% (10892/10892), 1.97 MiB | 0 bytes/s, done. Resolving deltas: 100% (7534/7534), done. >From ../a * [new ref] refs/refs/p -> refs/p mariner:b> git fetch -p ../a +refs/p:refs/p >From ../a x [deleted] (none) -> refs/p mariner:b> git fetch -p ../a +refs/p:refs/p >From ../a * [new ref] refs/refs/p -> refs/p mariner:b> git fetch -p ../a +refs/p:refs/p >From ../a x [deleted] (none) -> refs/p mariner:b> -- Ian Jackson <ijack...@chiark.greenend.org.uk> These opinions are my own. If I emailed you from an address @fyvzl.net or @evade.org.uk, that is a private address which bypasses my fierce spamfilter.