In our team, we have just migrated to git from TFS (I know!). However, we still have to perform maintenance on the TFS code base, which needs to be merged into the develop branch on git.
We have made the decision that the new git repo will not have the history from TFS mirrored. Instead, we start with an initial commit containing the whole code base from TFS.
So, we have something like this:
| Dev (TFS) | tfs-default (git-tfs) | develop (git) |
|---------------|---------------------------|-------------------|
| CS0001 | tfs0001 | |
| ... | ... | |
| CS1000 | tfs1000 | c0000 |
| CS1001 | tfs1001 | c0001 |
| CS1002 | tfs1001 | c0002 |
...where the code base after CS1000, tfs1000 and c0000 are identical, after which the subsequent changesets and commits diverge again.
As a side note, I am using the tfs bridge to import TFS changesets into a local git repo. However, this should not make any difference. Edit: it does. At the end, we end up with a branch in my local repo (let's call it tfs-dev) that is unrelated to my git develop branch.
I have trouble figuring out a workflow that allows for a good merging/rebasing experience. Whatever I try, I end up with conflicts where the full files are marked as different (git does not seem to detect that only one line of code has changed).
The git version I am using:
▶ git --version
git version 2.28.0.windows.1
git replace --graft tfs1001 c0000
and then rebase tfs-dev over c0000 (with and without -X theirs
)git replace --graft tfs1001 c0000
followed by git filter-branch CS1001..HEAD
git replace --graft tfs1001 c0000
and then pushing the branch to a remote and rebasing on a different repositoryAll these solutions led to me having full file conflicts, even if the change was actually a single line.
Would someone please suggest an alternative or tell me what I'm doing wrong? :)
Thanks in advance!
When cloning into git, autocrlf
defaults to false
. Issue #246 describes the details. When importing a change using git replace
, it will refer to the repository settings. Aligning autocrlf
is necessary to avoid confusion on line endings.