Jepzen
Jepzen

Reputation: 3162

git-tfs can I clone all branches but skip the history?

I want to migrate a project from TFVC to Git. I want to keep the different branches but I dont need each history. Can it be done?

I tried git tfs quick-clone -branches=all but I only fetches one branch

Upvotes: 1

Views: 1977

Answers (4)

YUu
YUu

Reputation: 79

https://github.com/git-tfs/git-tfs/blob/master/doc/commands/quick-clone.md

The quick-clone command creates a new git repository, initialized from the last changeset (or a specific changeset in history) in a TFS source tree, ignoring the full history. Useful for making code changes or additions where past history isn't relevant.

"quick-clone": If you dont mind which has the last changeset.

Upvotes: 0

Jepzen
Jepzen

Reputation: 3162

Solution was more simple than I first thought. Just create a new empty Git repository. Create a second branch. Copy files in from TFSVC folder. Commit. Switch branch, copy in the other TFSVC branch. Commit.

Upvotes: 2

Philippe
Philippe

Reputation: 31147

That's not possible but you could do as much 'quick-clone' as you want in different repositories and use the git remote feature to import them all in the same repository.

Not easy but doable...

Upvotes: 0

Cece Dong - MSFT
Cece Dong - MSFT

Reputation: 31043

If you want to work with tfs branches, you should clone one of the root branches. After you perform git push, all branches will be pushed to Git team projects.

Generally, the following steps would achieve your goal:

git-tfs clone http://tfsserver:8080/tfs/CollectionName/ $/teamproject/project .

git remote add origin http://tfsserver:8080/tfs/CollectionName/_git/gitproject

git push --all origin

Upvotes: 1

Related Questions