How to remove fake remote branches that I have after switching from git-svn to git?

I used git-svn for a while (everyone else on my team used svn directly). We decided that we would all start using git. For this, I used the git repo, which is my "side" of git-svn, for example:

$ git remote add origin git@github.com :mycompany/myproject.git $ git push -u origin master 

Everything went well, but when the process was completed, I saved all these funny branches created by git-svn when I first started using it, with one slight kink; git will no longer recognize that they were branches. Here's what my list looked like:

 $ git branch -r domain_integration dot-org dot-org@1977 email-edit-page origin/account-integration origin/master origin/stable prototype_to_jquery-1.1.0 stable@1976 tags/development-1.1.0.0 tags/pre-2011-02-08 tags/production-1.0 tags/stable-1.0.0 tags/stable-1.0.1 tags/stable-1.1.0 tags/stable-1.1.0.1 trunk-stash 

It was annoying, although I knew where they came from (mostly), but now I can’t even remove them. It happens:

 $ git branch -d trunk-stash error: branch 'trunk-stash' not found. 

I was able to fix some of them by going to .git / refs / remotes and just deleting them, but there were only a few. The only other place I can find them is .git / info / refs. Which looks something like this:

 ... 7788d300f0d4370d65a3ccf3e47d90f7fb16b0b4 refs/remotes/tags/stable-1.0.0 aace34d6745080ce2b6b29e927f5d1b050b99511 refs/remotes/tags/stable-1.0.1 58bd2ac23d5979ff61bd6305df18f8a5da50f888 refs/remotes/tags/stable-1.1.0 644fd55fcdf2569305cdbe0b6fefb9f247625658 refs/remotes/tags/stable-1.1.0.1 bc8e9f9177c9612aceb55624adea1b02e9e8620f refs/remotes/trunk 69493e14345e6a7a4db324935bccd6393f201da4 refs/remotes/trunk-stash 25b7024f6c1d38c10400b2c2e7b446aae1e84e06 refs/stash ... 

I assume this is only related to the branches with their last commits. Does it make sense to remove the "fake"? Will it break something? (Will it work?)

+4
source share
1 answer

If you only need the master branch, you can always delete the local repo and re-clone it. This is easiest if you don't care, except for the master branch. You can always try:

 git remote prune origin 

To get rid of deleted links that are no longer in their original state, but are saved locally.

+2
source

Source: https://habr.com/ru/post/1399610/


All Articles