0

I have a Git repo that has been acting funny.

I can checkout all of my branches, I can work on each of them normally, and I can perform gitk to each one and view their individual commits successfully — with one exception...

.... there is one branch that I can't seem to access. With any action I try to perform that includes the flawed branch, I receive an error.

For example: gitk --all yields fatal: blah blah blah (as a side note, more details about the error can be viewed here, but I am trying to come by a solution from a totally different angle).

The Question

Is there a way to recombine all of the other, working branches together such that I can use this repo again — only losing the commits from the broken branch since the broken branch does not have any other branches extending from it?

Community
  • 1
  • 1
ServAce85
  • 1,602
  • 2
  • 23
  • 51
  • Nobody can help you if you give us the error message "bla bla bla" – Ana Betts Mar 02 '12 at 07:14
  • @PaulBetts I completely understand, but that's not really important in the question. However, if you, or someone else, feels that it may be relevant, I have linked to a question that containes much more information about it. This question is more about combining `git` `branch`es into one repo. – ServAce85 Mar 02 '12 at 07:17
  • Are you just asking how to delete your corrupted branch? – Ana Betts Mar 02 '12 at 07:19
  • @PaulBetts Not exactly. I have tried that, but the error won't allow me to do that. I am asking if there is a way to create a new repo and populate it with `GoodBranchA`, then add `GoodBranchB`, etc. reconstructing my original repo, but without adding the branch `BadBranch`. – ServAce85 Mar 02 '12 at 07:35
  • 1
    Ah, I see - just go into .git and delete refs/heads/BadBranch – Ana Betts Mar 02 '12 at 19:31

1 Answers1

0

You could create a remote and push all your 'good' branches onto that remote. Then in a new local directory, do a git clone of that remote.

After that, if you do git branch -a you should see all your local and remote branches. You can create a local tracking branch for each remote branch with:

    git checkout -b branch remote/branch

After this, you should have a local repo with all 'good' branches.

triad
  • 20,407
  • 13
  • 45
  • 50