Where does Git store remote tracking branches












6















I have to Git repos repo1 and repo2. There are three branches master, alpha and beta in repo1. repo2 clones from repo1.



In repo2, I can see remote tracking branches with git branch -a:



remotes/origin/HEAD -> origin/master
remotes/origin/master
remotes/origin/alpha
remotes/origin/beta


But the folder .git/refs/remotes/origin/ in repo2 only has a single file HEAD, whose content is:



ref: refs/remotes/origin/master


So this HEAD is a symbolic ref. But why does it point to a ref that doesn't exist? BTW, where does repo2 store the information of alpha and beta? (repo2 knows alpha and beta because it displays them in git branch -a.)










share|improve this question























  • Which version are you running? and did you init and fetch, or just clone. I ask because there are settings available for what should be fetched by default.

    – Philip Oakley
    Nov 3 '12 at 10:44











  • Is this all on the same machine, and could your installation be using symlinks rather than having a true second copy?

    – Philip Oakley
    Nov 3 '12 at 11:26











  • @PhilipOakley They're on the same machine. And the answer is pointed out below. I forgot the packed-refs issue...

    – Cyker
    Nov 4 '12 at 7:19
















6















I have to Git repos repo1 and repo2. There are three branches master, alpha and beta in repo1. repo2 clones from repo1.



In repo2, I can see remote tracking branches with git branch -a:



remotes/origin/HEAD -> origin/master
remotes/origin/master
remotes/origin/alpha
remotes/origin/beta


But the folder .git/refs/remotes/origin/ in repo2 only has a single file HEAD, whose content is:



ref: refs/remotes/origin/master


So this HEAD is a symbolic ref. But why does it point to a ref that doesn't exist? BTW, where does repo2 store the information of alpha and beta? (repo2 knows alpha and beta because it displays them in git branch -a.)










share|improve this question























  • Which version are you running? and did you init and fetch, or just clone. I ask because there are settings available for what should be fetched by default.

    – Philip Oakley
    Nov 3 '12 at 10:44











  • Is this all on the same machine, and could your installation be using symlinks rather than having a true second copy?

    – Philip Oakley
    Nov 3 '12 at 11:26











  • @PhilipOakley They're on the same machine. And the answer is pointed out below. I forgot the packed-refs issue...

    – Cyker
    Nov 4 '12 at 7:19














6












6








6


3






I have to Git repos repo1 and repo2. There are three branches master, alpha and beta in repo1. repo2 clones from repo1.



In repo2, I can see remote tracking branches with git branch -a:



remotes/origin/HEAD -> origin/master
remotes/origin/master
remotes/origin/alpha
remotes/origin/beta


But the folder .git/refs/remotes/origin/ in repo2 only has a single file HEAD, whose content is:



ref: refs/remotes/origin/master


So this HEAD is a symbolic ref. But why does it point to a ref that doesn't exist? BTW, where does repo2 store the information of alpha and beta? (repo2 knows alpha and beta because it displays them in git branch -a.)










share|improve this question














I have to Git repos repo1 and repo2. There are three branches master, alpha and beta in repo1. repo2 clones from repo1.



In repo2, I can see remote tracking branches with git branch -a:



remotes/origin/HEAD -> origin/master
remotes/origin/master
remotes/origin/alpha
remotes/origin/beta


But the folder .git/refs/remotes/origin/ in repo2 only has a single file HEAD, whose content is:



ref: refs/remotes/origin/master


So this HEAD is a symbolic ref. But why does it point to a ref that doesn't exist? BTW, where does repo2 store the information of alpha and beta? (repo2 knows alpha and beta because it displays them in git branch -a.)







git






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 2 '12 at 22:12









CykerCyker

2,95453245




2,95453245













  • Which version are you running? and did you init and fetch, or just clone. I ask because there are settings available for what should be fetched by default.

    – Philip Oakley
    Nov 3 '12 at 10:44











  • Is this all on the same machine, and could your installation be using symlinks rather than having a true second copy?

    – Philip Oakley
    Nov 3 '12 at 11:26











  • @PhilipOakley They're on the same machine. And the answer is pointed out below. I forgot the packed-refs issue...

    – Cyker
    Nov 4 '12 at 7:19



















  • Which version are you running? and did you init and fetch, or just clone. I ask because there are settings available for what should be fetched by default.

    – Philip Oakley
    Nov 3 '12 at 10:44











  • Is this all on the same machine, and could your installation be using symlinks rather than having a true second copy?

    – Philip Oakley
    Nov 3 '12 at 11:26











  • @PhilipOakley They're on the same machine. And the answer is pointed out below. I forgot the packed-refs issue...

    – Cyker
    Nov 4 '12 at 7:19

















Which version are you running? and did you init and fetch, or just clone. I ask because there are settings available for what should be fetched by default.

– Philip Oakley
Nov 3 '12 at 10:44





Which version are you running? and did you init and fetch, or just clone. I ask because there are settings available for what should be fetched by default.

– Philip Oakley
Nov 3 '12 at 10:44













Is this all on the same machine, and could your installation be using symlinks rather than having a true second copy?

– Philip Oakley
Nov 3 '12 at 11:26





Is this all on the same machine, and could your installation be using symlinks rather than having a true second copy?

– Philip Oakley
Nov 3 '12 at 11:26













@PhilipOakley They're on the same machine. And the answer is pointed out below. I forgot the packed-refs issue...

– Cyker
Nov 4 '12 at 7:19





@PhilipOakley They're on the same machine. And the answer is pointed out below. I forgot the packed-refs issue...

– Cyker
Nov 4 '12 at 7:19












2 Answers
2






active

oldest

votes


















7














The refs are probably "packed" in .git/packed-refs.






share|improve this answer



















  • 2





    git help pack-refs clarifies everything. Thanks!

    – Cyker
    Nov 3 '12 at 4:05



















3














The information is in .git/config and is updated by tools like git remote when you add or modify remotes. There is a manual page on git-config. If you search for "tracking branches" you'll see details of how they are configured.






share|improve this answer
























  • This is false. Remote tracking branches are not stored in .git/config. All branches are stored in .git/refs/ or .git/packed-refs. Only tracking metadata for local branches and fetch and push refspecs are stored in .git/config.

    – CB Bailey
    Nov 2 '12 at 23:48











  • @CharlesBailey: The word "tracking" in the question seemed to be the most specific part of the request, so I focused on the tracking metadata.

    – Ben Jackson
    Nov 3 '12 at 1:22











  • This fixed my issue: visual studio 2013 current branch does not have an upstream branch configured

    – JohnWrensby
    Dec 22 '17 at 1:55











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f13203728%2fwhere-does-git-store-remote-tracking-branches%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









7














The refs are probably "packed" in .git/packed-refs.






share|improve this answer



















  • 2





    git help pack-refs clarifies everything. Thanks!

    – Cyker
    Nov 3 '12 at 4:05
















7














The refs are probably "packed" in .git/packed-refs.






share|improve this answer



















  • 2





    git help pack-refs clarifies everything. Thanks!

    – Cyker
    Nov 3 '12 at 4:05














7












7








7







The refs are probably "packed" in .git/packed-refs.






share|improve this answer













The refs are probably "packed" in .git/packed-refs.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 2 '12 at 23:27









CB BaileyCB Bailey

514k78555611




514k78555611








  • 2





    git help pack-refs clarifies everything. Thanks!

    – Cyker
    Nov 3 '12 at 4:05














  • 2





    git help pack-refs clarifies everything. Thanks!

    – Cyker
    Nov 3 '12 at 4:05








2




2





git help pack-refs clarifies everything. Thanks!

– Cyker
Nov 3 '12 at 4:05





git help pack-refs clarifies everything. Thanks!

– Cyker
Nov 3 '12 at 4:05













3














The information is in .git/config and is updated by tools like git remote when you add or modify remotes. There is a manual page on git-config. If you search for "tracking branches" you'll see details of how they are configured.






share|improve this answer
























  • This is false. Remote tracking branches are not stored in .git/config. All branches are stored in .git/refs/ or .git/packed-refs. Only tracking metadata for local branches and fetch and push refspecs are stored in .git/config.

    – CB Bailey
    Nov 2 '12 at 23:48











  • @CharlesBailey: The word "tracking" in the question seemed to be the most specific part of the request, so I focused on the tracking metadata.

    – Ben Jackson
    Nov 3 '12 at 1:22











  • This fixed my issue: visual studio 2013 current branch does not have an upstream branch configured

    – JohnWrensby
    Dec 22 '17 at 1:55
















3














The information is in .git/config and is updated by tools like git remote when you add or modify remotes. There is a manual page on git-config. If you search for "tracking branches" you'll see details of how they are configured.






share|improve this answer
























  • This is false. Remote tracking branches are not stored in .git/config. All branches are stored in .git/refs/ or .git/packed-refs. Only tracking metadata for local branches and fetch and push refspecs are stored in .git/config.

    – CB Bailey
    Nov 2 '12 at 23:48











  • @CharlesBailey: The word "tracking" in the question seemed to be the most specific part of the request, so I focused on the tracking metadata.

    – Ben Jackson
    Nov 3 '12 at 1:22











  • This fixed my issue: visual studio 2013 current branch does not have an upstream branch configured

    – JohnWrensby
    Dec 22 '17 at 1:55














3












3








3







The information is in .git/config and is updated by tools like git remote when you add or modify remotes. There is a manual page on git-config. If you search for "tracking branches" you'll see details of how they are configured.






share|improve this answer













The information is in .git/config and is updated by tools like git remote when you add or modify remotes. There is a manual page on git-config. If you search for "tracking branches" you'll see details of how they are configured.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 2 '12 at 22:21









Ben JacksonBen Jackson

60.4k776131




60.4k776131













  • This is false. Remote tracking branches are not stored in .git/config. All branches are stored in .git/refs/ or .git/packed-refs. Only tracking metadata for local branches and fetch and push refspecs are stored in .git/config.

    – CB Bailey
    Nov 2 '12 at 23:48











  • @CharlesBailey: The word "tracking" in the question seemed to be the most specific part of the request, so I focused on the tracking metadata.

    – Ben Jackson
    Nov 3 '12 at 1:22











  • This fixed my issue: visual studio 2013 current branch does not have an upstream branch configured

    – JohnWrensby
    Dec 22 '17 at 1:55



















  • This is false. Remote tracking branches are not stored in .git/config. All branches are stored in .git/refs/ or .git/packed-refs. Only tracking metadata for local branches and fetch and push refspecs are stored in .git/config.

    – CB Bailey
    Nov 2 '12 at 23:48











  • @CharlesBailey: The word "tracking" in the question seemed to be the most specific part of the request, so I focused on the tracking metadata.

    – Ben Jackson
    Nov 3 '12 at 1:22











  • This fixed my issue: visual studio 2013 current branch does not have an upstream branch configured

    – JohnWrensby
    Dec 22 '17 at 1:55

















This is false. Remote tracking branches are not stored in .git/config. All branches are stored in .git/refs/ or .git/packed-refs. Only tracking metadata for local branches and fetch and push refspecs are stored in .git/config.

– CB Bailey
Nov 2 '12 at 23:48





This is false. Remote tracking branches are not stored in .git/config. All branches are stored in .git/refs/ or .git/packed-refs. Only tracking metadata for local branches and fetch and push refspecs are stored in .git/config.

– CB Bailey
Nov 2 '12 at 23:48













@CharlesBailey: The word "tracking" in the question seemed to be the most specific part of the request, so I focused on the tracking metadata.

– Ben Jackson
Nov 3 '12 at 1:22





@CharlesBailey: The word "tracking" in the question seemed to be the most specific part of the request, so I focused on the tracking metadata.

– Ben Jackson
Nov 3 '12 at 1:22













This fixed my issue: visual studio 2013 current branch does not have an upstream branch configured

– JohnWrensby
Dec 22 '17 at 1:55





This fixed my issue: visual studio 2013 current branch does not have an upstream branch configured

– JohnWrensby
Dec 22 '17 at 1:55


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f13203728%2fwhere-does-git-store-remote-tracking-branches%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Homophylophilia

Updating UILabel text programmatically using a function

Cloud Functions - OpenCV Videocapture Read method fails for larger files from cloud storage