I have 2 remotes - origin and remote2 one and I want to rename remote2 to origin and origin to source. Is it safe to do so? If yes, how do I do it?
Edit: By safe I mean that if some branch is tracked from "origin", will it continue to be track from "source" after rename. Also I wish I new what else could go wrong :)
I believe it is safe, yes, unless you have scripts referencing the remote by name for instance (in which case these will still use the old remote name).
The command is:
git remote rename <old> <new>
So if you have something tracked from foo
, then rename foo
to bar
, it will now be tracked from bar
. To check, use:
git remote -v show
git branch -a -v
before and after.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With