2

I have cloned a repo into my local folders and now I wanted to change my git repository to some other url. I have already changed it using

git remote set-url origin git://new.url.here

and when I am doing

git remote -v

it shows me the correct repository in which I want to work.But when I do

git branch --all

it shows me the old branches in the old repository. I am wondering why?? As my new repo doesn't have any branches yet.

Mureinik
  • 297,002
  • 52
  • 306
  • 350
Apaar Bhatnagar
  • 119
  • 1
  • 8

2 Answers2

1

You are in fact seeing local copies of the old remote branches. You could use git remote prune origin to remove them. To be on the safe side, it's recommended you run git remote prune origin --dry-run first, just to see what exactly would be removed before removing it.

Mureinik
  • 297,002
  • 52
  • 306
  • 350
1

The branches loaded in your repository are the old one anyway, since otherwise they would be lost. If you do not need them (as you have done the upstream push to the new remote), follow these instructions to delete the old remote branches (watch out though: you should change back to the old remote, delete, and switch back again) How do I delete a Git branch both locally and remotely?

Community
  • 1
  • 1
Vale
  • 1,104
  • 1
  • 10
  • 29