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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

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

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

(2) ShareShare
ReportReport
Posted on by 14
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
    239,040 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.
  • Verified answer
    Hamza BOUMRAR Profile Picture
    14 on at
    It moving a TFVC Repository to another TFVC Repository. 

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

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

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 616

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 460 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 331 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans