I have a TFS hosted git repo (e.g. https://tfsfoo.com/_git), and I need to move it to another TFS host (e.g. https://tfsbar.com/_git)
My solution is to do the following (modified based on suggestion below to use --mirror):
- git clone https://tfsfoo.com/_git/proj --mirror
- Loop through branches (git branch -r) and then git branch --track each of those (as in this post)
- Note that I had already pushed to the new repo (without branches), so --mirror wasn't an option.
- git pull
- git remote set-url origin https://tfsbar.com/_git/proj
- git push --all --follow-tags
Now - I know I can just try this to see if it works (and I probably will while I wait for answers), but given that there are multiple ways to do just about everything in git, I'm wondering if there's a better way - or more importantly, if there's anything wrong with this approach (I'm relatively new to git).