Reputation: 695
I cloned a TFS repo using git-tfs clone <tfs-url>
command to my local machine amd when its done, I opened the folder and do a git log and I could see all the beautiful history.
Now, when I create a new private repo and clone that repo to my local then copy paste all the objects from TFS (that i just cloned to my local) into the new repo and git push
it, I dont see the beautiful history, only 1 history of me pushing it to the new repo. I need to have the old history from TFS repo intact. How do I do that?
Also, idk if it helps but when I opened the cloned TFS folder on my local machine and I do git remote -v, there is nothing no remote at all, its just empty, i thought git-tfs clone
would add git remote automatically but it doesnt. Unlike git clone
which automatically creates a remote connection called origin pointing back to the cloned repository as stated in here
Upvotes: 1
Views: 442
Reputation: 695
nvm found the answer
git remote add <origin-url>
git push origin master
Upvotes: 1
Reputation: 8298
I need to have the old history from TFS repo intact.
For Git, just using the Import Repository feature, you can import a Git repository to your team project from other project's git repo. The newly imported repo will keep all commit history. For details, please refer to this document.
The import repo feature was introduced in TFS 2017 Update 1. If you are using TFS 2017 RTM or earlier, you can use the following steps to manually import a repo into TFS.
git clone --bare {clone repo url}
cd repo name.git
git push --mirror {target repo url}
If you do not know the path, we can call the cmd dir
to load the file list and then find the path.
Upvotes: 0
Reputation: 31147
Now, when I create a new private repo and clone that repo to my local then copy paste all the objects from TFS (that i just cloned to my local) into the new repo and git push it, I dont see the beautiful history, only 1 history of me pushing it to the new repo. I need to have the old history from TFS repo intact. How do I do that?
What you did is not pushing your history, but just committing the tip of your source code.
See what I have written in the git-tfs documentation to add a remote toward your newly created git repository and push the history :
Also, idk if it helps but when I opened the cloned TFS folder on my local machine and I do git remote -v, there is nothing no remote at all, its just empty, i thought git-tfs clone would add git remote automatically but it doesnt.
That's something that git-tfs can't do and makes no sense. Git-tfs does not know the newly created repository (and don't manage the TFVC link as a git remote to not confuse users).
Upvotes: 0