-2

I ran git remote remove origin;, and after that, git log --all --decorate; shows several branches from origin, such as origin/master, origin/devel, etc.

These are not local branches.

I've used git remote prune origin and git remote update --prune, but nothing changes. The first command prunes local tracking branches, so I don't expect it to help. The second command says "prune all the remotes that are updated.", and origin wasn't actually updated; perhaps this is why it's not pruning that repo?

How do I make git forget about this repository completely?

lmat - Reinstate Monica
  • 7,289
  • 6
  • 48
  • 62

2 Answers2

-1

To see what's going on with your remotes, use the git remote -v command. It will produce something like:

$ git remote -v
bakkdoor  https://github.com/bakkdoor/grit (fetch)
bakkdoor  https://github.com/bakkdoor/grit (push)
cho45     https://github.com/cho45/grit (fetch)
cho45     https://github.com/cho45/grit (push)
origin    git@github.com:mojombo/grit.git (fetch)
origin    git@github.com:mojombo/grit.git (push)

Say you wanted to remove the REMOTE cho45 repo, do the following:

$ git remote rm cho45

Then confirm it:

$ git remote -v
bakkdoor  https://github.com/bakkdoor/grit (fetch)
bakkdoor  https://github.com/bakkdoor/grit (push)
origin    git@github.com:mojombo/grit.git (fetch)
origin    git@github.com:mojombo/grit.git (push)

If you want your LOCAL git to forget that REMOTE repo, then you can use the following process. BUT, it will toast that repo, be really sure you want that.

cd cho45/.git
rm -rf origin
cd refs/remotes
rm -rf origin
WPrecht
  • 1,340
  • 1
  • 17
  • 29
  • That's right, and that's what I see. I'm more concerned with the output of git log --all --decorate; I see the branches from origin still in there. How do I make them go away? – lmat - Reinstate Monica Aug 23 '16 at 15:43
  • In the local repo? – WPrecht Aug 23 '16 at 18:43
  • 1
    If you want your LOCAL git to forget that REMOTE repo, then @Limited's answer is the way to go. BUT, it will toast that repo, be really sure you want that. – WPrecht Aug 23 '16 at 18:50
  • That's right. The local repo should have no knowledge of that remote. I would rather accept your answer than my own answer. Can you change your answer to reflect this so I can accept it? Thanks! – lmat - Reinstate Monica Aug 24 '16 at 13:22
-1

I'm not sure how to do this with the git client, but perhaps what you're wanting is

cd .git;
rm -rf origin;
cd refs/remotes;
rm -rf origin;

This will get rid of all those branch names in git log --all --decorate; but I'm not sure if it's safe.

lmat - Reinstate Monica
  • 7,289
  • 6
  • 48
  • 62