web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

How to Migrate TFVC Repository Between Azure DevOps Organizations While Preserving History

(0) ShareShare
ReportReport
Posted on by
I recently completed a full migration of our D365 F&O source code from one Azure DevOps organization to another. Since I couldn't find a comprehensive guide online, I'm sharing the complete process that worked for me.
 
Prerequisites
- Git installed
- git-tfs installed (`choco install gittfs`)
- Git Bash
- Visual Studio 2022
 
Phase 1: Clone Source Repository

git tfs clone "https://dev.azure.com/SOURCE-ORG" "$/PROJECT/Trunk/Main" --changeset=XXXX
Use `--changeset=XXXX` to specify the first changeset you want to include in the migration.
 
Phase 2: Clean Metadata (CRITICAL STEP!)
 
Each commit contains a `git-tfs-id:` line pointing to the source server. **This MUST be removed** before pushing to the destination.
**Open Git Bash**:

cd /c/path/to/cloned/repo
FILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch -f --msg-filter 'sed "/git-tfs-id:/d"' -- --all
 
**Verify the cleanup:**
git log -1
 
The commit message should **no longer** contain `git-tfs-id:`.
**Remove empty commits (if any):**
git rebase -i --root
 
In the editor, change `pick` to `drop` for any empty commits. If the first commit is empty, delete the entire line.
 
## Phase 3: Prepare Destination
1. Go to destination Azure DevOps → **Repos** → **TFVC**
2. Create the folder structure (e.g., `$/PROJECT/trunk/Main`)
3. Add a `README.txt` file
4. Check-in the changes
**Clone the destination repository:**
git tfs clone "https://dev.azure.com/DEST-ORG" "$/PROJECT/trunk/Main" NewRepo
 
Phase 4: Migration with History

cd NewRepo
# Add source repo as remote
git remote add oldrepo "C:\path\to\source\repo"
git fetch oldrepo
# Rebase commits onto destination
git rebase --onto tfs/default --root oldrepo/master
# Push to TFS (each commit becomes a separate changeset)
git tfs rcheckin
 
Categories:
I have the same question (0)
  • Martin Dráb Profile Picture
    237,734 Most Valuable Professional on at
    Thank you, but note that this is a discussion forum. You should use a blogging platform instead.
     
    By the way, you should fix the title. It says that you're migrating a TFVC repository between organizations, but you're actually moving a content of a TFVC repository to Git.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 700 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 567 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 408 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans