0

I'm running into trouble with my git repo. I had a bunch of branch that I realize are missing and I came to this conclusion. My file structure looks like this

REPO-A  
  -/hooks  
  -/info  
  -/objects  
  -/ref  
  -config  
  -description  
  -HEAD  
  -packed-ref  
  -/.git  
    --/hooks  
    --/info  
    --/log  
    --/objects  
    --/ref  
    --COMMITMESSAGE  
    --config  
    --description  
    --FETCH_HEAD  
    --HEAD

When I clone my repo I only see some of my branches that I had and I only have one submodule. If however I delete the /.git file and everything contained under it, I get all my branches back but the ones that I see when the /.git file there are out of date. I was wondering what has happened and how to undo it? I've searched all the reflogs of everyone who’s pushes to the repo but they seem to be all pushes, so I'm a little lost. Any help would be appreciated!

LeGEC
  • 46,477
  • 5
  • 57
  • 104
Tendy
  • 25
  • 4
  • What you have looks like an outer `--bare` style repository with an inner repository. It's not clear to me how this got set up, nor which one of these two repositories is correct (or both, or neither). Perhaps someone cleared the `core.bare` flag manually in the outer repository. – torek Jun 02 '20 at 19:54

1 Answers1

1

git commands will determine where the git repo is in the following way :

  • it will look for .git/ in .,
  • if not present, it will go up one level, and look for .git/
  • if not present, it will go up one level, ...

So :

  • deleting the .git/ directory means deleting the repository part, and keeping only the files on disk as they are,
  • if something shows up when you run some git command, this indicates that there is a .git/ directory in some parent directory.

You can run git rev-parse --show-toplevel to view what git chose as the base directory of your repo.


If you want to update the branches in that repo, use git fetch and git pull.

LeGEC
  • 46,477
  • 5
  • 57
  • 104
  • So what you're saying is that I have a separate repo insde my repo, it just coincidentally that they have some overlapping branches? I find it weird though because when i clone the top repo it goes goes down and get the ./git repo below it instead of actually geting the top repo. – Tendy Jun 02 '20 at 16:32