You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/repos/git/import-from-TFVC.md
+146-9
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
-
title: Import repositories from TFVC to Git
2
+
title: Import and migrate repositories from TFVC to Git
3
3
titleSuffix: Azure Repos
4
-
description: Search your Git repo in Azure DevOps Services or TFS for a specific file or folderImport your repositories from TFVC to Git repositories within the same account.
4
+
description: Import and migrate your repositories from TFVC to Git repositories within the same account.
5
5
ms.assetid: cf1a4dc8-7143-4b0e-8a43-1680533fb3cb
6
6
ms.service: azure-devops-repos
7
7
ms.topic: conceptual
@@ -10,7 +10,7 @@ monikerRange: '<= azure-devops'
10
10
ms.subservice: azure-devops-repos-git
11
11
---
12
12
13
-
# Import repositories from TFVC to Git
13
+
# Import and migrate repositories from TFVC to Git
@@ -20,12 +20,12 @@ You can migrate code from an existing TFVC repository to a new Git repository wi
20
20
* Removing binaries and executables
21
21
* Training your team
22
22
23
-
We strongly recommend reading our whitepapers - [Centralized version control to Git](/devops/develop/git/centralized-to-git) and [TFVC to Git](/devops/develop/git/migrate-from-tfvc-to-git) before starting the migration.
23
+
We strongly recommend reading [Centralized version control to Git](/devops/develop/git/centralized-to-git) and the following [Migrate from TFVC to Git](#migrate-from-tfvc-to-git) section before starting the migration.
24
24
25
-
The import experience is great for small simple TFVC repositories. It's also good for repositories that have already been "cleaned up" as outlined in the previous whitepapers. Those whitepapers also recommend other tools for more advanced TFVC repository configurations.
25
+
The import experience is great for small simple TFVC repositories. It's also good for repositories that have already been "cleaned up" as outlined in [Centralized version control to Git](/devops/develop/git/centralized-to-git) and the following [Migrate from TFVC to Git](#migrate-from-tfvc-to-git) section. These sections also recommend other tools for more advanced TFVC repository configurations.
26
26
27
27
> [!IMPORTANT]
28
-
> Due to the differences in how TFVC and Git store version control history, we [recommend](/devops/develop/git/migrate-from-tfvc-to-git) that you don't migrate your history. This is the approach that Microsoft took when it migrated Windows and other products from centralized version control to Git.
28
+
> Due to the differences in how TFVC and Git store version control history, we recommend that you don't migrate your history. This is the approach that Microsoft took when it migrated Windows and other products from centralized version control to Git.
29
29
30
30
## Importing the repository
31
31
@@ -70,7 +70,7 @@ A link to the TFVC repository is added in the commit message of the 1st changese
> Due to the differences in how TFVC and Git store version control history, we [recommend](/devops/develop/git/migrate-from-tfvc-to-git) that you don't migrate your history. This is the approach that Microsoft took when it migrated Windows and other products from centralized version control to Git.
73
+
> Due to the differences in how TFVC and Git store version control history, we recommend that you don't migrate your history. This is the approach that Microsoft took when it migrated Windows and other products from centralized version control to Git.
74
74
75
75
::: moniker-end
76
76
@@ -83,8 +83,145 @@ while `$/Fabrikam/<branch>` would only import the branch.
83
83
2. The imported repository and associated history (if imported) cannot exceed 1GB in size.
84
84
3. You can import up to 180 days of history.
85
85
86
-
If any of the above is a blocker for your import, we recommend you try external tools like [Git-TFS](https://github.com/git-tfs/git-tfs) for importing and reading our whitepapers - [Centralized version control to Git](/devops/develop/git/centralized-to-git) and [TFVC to Git](/devops/develop/git/migrate-from-tfvc-to-git)
86
+
If any of the above is a blocker for your import, we recommend you try external tools like [Git-TFS](https://github.com/git-tfs/git-tfs) for importing and reading our whitepapers - [Centralized version control to Git](/devops/develop/git/centralized-to-git) and the following [Migrate from TFVC to Git](#migrate-from-tfvc-to-git) section.
87
87
88
88
89
-
> [!NOTE]
89
+
> [!IMPORTANT]
90
90
> The usage of external tools like [Git-TFS](https://github.com/git-tfs/git-tfs) with Microsoft products, services, or platforms is entirely the responsibility of the user. Microsoft does not endorse, support, or guarantee the functionality, reliability, or security of such third-party extensions.
91
+
92
+
## Migrate from TFVC to Git
93
+
94
+
Before migrating source code from a centralized version control system to Git, understand the
95
+
differences between the two and [prepare for the migration](/devops/develop/git/centralized-to-git).
96
+
97
+
*[Requirements](#requirements)
98
+
*[Steps to migrate](#steps-to-migrate)
99
+
*[Check out the latest version](#check-out-the-latest-version)
100
+
*[Remove binaries and build tools](#remove-binaries-and-build-tools)
101
+
*[Convert version control-specific configuration](#convert-version-control-specific-configuration)
102
+
*[Check in changes and perform the migration](#check-in-changes-and-perform-the-migration)
103
+
*[Advanced migrations](#advanced-migrations)
104
+
*[Update the workflow](#update-the-workflow)
105
+
106
+
### Requirements
107
+
108
+
In order to make migrations easier, there are a number of requirements before following the [importing the repository](#importing-the-repository) procedure in the previous section of this article.
109
+
110
+
* Migrate only a single branch. When [planning the migration](/devops/develop/git/centralized-to-git), choose a new
111
+
branching strategy for Git. Migrating only the main branch supports a topic-branch based workflow like
or [GitHub Flow](https://guides.github.com/introduction/flow/index.html).
114
+
* Do a tip migration, as in, import only the latest version of the source code. If TFVC history is simple,
115
+
there's an option to migrate some history, up to 180 days, so that the team can work only out of Git.
116
+
For more information, see [Plan your migration to Git](/devops/develop/git/centralized-to-git).
117
+
* Exclude binary assets like images, scientific data sets, or game models from the repository. These assets
118
+
should use the Git LFS (Large File Support) extension, which the import tool doesn't configure.
119
+
* Keep the imported repository below 1GB in size.
120
+
121
+
If the repository doesn't meet these requirements, use the [Git-TFS tool](https://github.com/git-tfs/git-tfs)
122
+
to do your migration instead.
123
+
124
+
> [!IMPORTANT]
125
+
> The usage of external tools like [Git-TFS](https://github.com/git-tfs/git-tfs) with Microsoft products, services, or platforms is entirely the responsibility of the user. Microsoft does not endorse, support, or guarantee the functionality, reliability, or security of such third-party extensions.
126
+
127
+
### Steps to migrate
128
+
129
+
The process to migrate from TFVC is generally straightforward:
130
+
131
+
1.[Check out the latest version](#check-out-the-latest-version) of the branch from TFVC on your local disk.
132
+
2.[Remove binaries and build tools](#remove-binaries-and-build-tools) from the repository and set up a package management system like NuGet.
133
+
3.[Convert version control-specific configuration](#convert-version-control-specific-configuration) directives. For example, convert `.tfignore` files to
134
+
[`.gitignore`](https://git-scm.com/docs/gitignore), and convert `.tpattributes` files to
4.[Check in changes and perform the migration](#check-in-changes-and-perform-the-migration) to Git.
137
+
138
+
Steps 1-3 are optional. If there aren't binaries in the repository and there's no need to set up a
139
+
`.gitignore` or a `.gitattributes`, you can proceed directly to the [Check in changes and perform the migration](#check-in-changes-and-perform-the-migration) step.
140
+
141
+
#### Check out the latest version
142
+
143
+
Create a new TFS workspace and map a working folder for the server directory being migrated to Git. This
144
+
doesn't require a full working folder mapping. Only map folders that contain binaries to be removed
145
+
from the repository and folders that contain version control system-specific configuration files like
146
+
`.tfignore`.
147
+
148
+
Once mappings are set up, get the folder locally:
149
+
150
+
```prettyprint
151
+
tf get /version:T /recursive
152
+
```
153
+
154
+
#### Remove binaries and build tools
155
+
156
+
Due to the way Git stores the history of changed files by providing a copy of every file in history to
157
+
every developer, checking in binary files directly to the repository causes the repo to grow quickly and
158
+
can cause performance issues.
159
+
160
+
For build tools and dependencies like libraries, adopt a [packaging solution](../../artifacts/start-using-azure-artifacts.md)
161
+
with versioning support, such as NuGet. Many open source tools and libraries are already available on the
162
+
[NuGet Gallery](https://www.nuget.org/), but for proprietary dependencies, create new NuGet packages.
163
+
164
+
Once dependencies are moved into NuGet, be sure that they aren't included in the Git repository
165
+
by adding them to [`.gitignore`](./ignore-files.md).
166
+
167
+
#### Convert version control-specific configuration
168
+
169
+
Team Foundation Version Control provides a `.tfignore` file, which ensures that certain files aren't
170
+
added to the TFVC repository. You can use the `.tfignore` file for automatically generated files like build
171
+
output so that they aren't accidentally checked in.
172
+
173
+
If the project relies on this behavior, convert the `.tfignore` file to a
174
+
[`.gitignore`](./ignore-files.md) file.
175
+
176
+
Cross-platform TFVC clients also provide support for a `.tpattributes` file that controls how files
177
+
are placed on the local disk or checked into the repository. If a `.tpattributes` file is in use,
178
+
convert it to a [`.gitattributes`](https://git-scm.com/docs/gitattributes) file.
179
+
180
+
#### Check in changes and perform the migration
181
+
182
+
Check in any changes that remove binaries, migrate to package management, or convert version
183
+
control-specific configuration. Once you make this final change in TFVC, you can do the import.
184
+
185
+
Follow the [Importing the repository](#importing-the-repository) procedure to do
186
+
the import.
187
+
188
+
#### Advanced migrations
189
+
190
+
The [Git-TFS tool](https://github.com/git-tfs/git-tfs) is a two-way bridge between Team Foundation
191
+
Version Control and Git, and you can use it to perform a migration. Git-TFS is appropriate for a
192
+
migration with full history, more than the 180 days that the Import tool supports. Or you can use
193
+
Git-TFS to attempt a migration that includes multiple branches and merge relationships.
194
+
195
+
Before attempting a migration with Git-TFS, note that there are fundamental differences between
196
+
the way TFVC and Git store history:
197
+
198
+
- Git stores history as a snapshot of the repository in time, while TFVC records the discrete
199
+
operations that occurred on a file. Change types in TFVC like rename, undelete, and rollback can't
200
+
be expressed in Git. Instead of seeing that file `A` was renamed to file `B`, it only tracks
201
+
that file `A` was deleted and file `B` was added in the same commit.
202
+
- Git doesn't have a direct analog of a TFVC label. Labels can contain any number of files at any
203
+
specific version and can reflect files at different versions. Although conceptually similar, the Git tags
204
+
point to a snapshot of the whole repository at a point in time. If the project relies on TFVC labels
205
+
to know what was delivered, Git tags might not provide this information.
206
+
- Merges in TFVC occur at the file level, not at the entire repository. Only a subset of changed files
207
+
can be merged from one branch to another. Remaining changed files might then be merged in a subsequent
208
+
changeset. In Git, a merge affects the entire repository, and both sets of individual changes
209
+
can't be seen as a merge.
210
+
211
+
Because of these differences, it's recommended that you do a tip migration and keep your TFVC
212
+
repository online, but read-only, in order to view history.
213
+
214
+
To attempt an advanced migration with Git-TFS, see
215
+
[clone a single branch with history](https://github.com/git-tfs/git-tfs/blob/master/doc/usecases/manage_tfs_branches.md#clone-just-the-trunk)
216
+
or [clone all branches with merge history](https://github.com/git-tfs/git-tfs/blob/master/doc/usecases/manage_tfs_branches.md#clone-all-history).
217
+
218
+
> [!IMPORTANT]
219
+
> The usage of external tools like [Git-TFS](https://github.com/git-tfs/git-tfs) with Microsoft products, services, or platforms is entirely the responsibility of the user. Microsoft does not endorse, support, or guarantee the functionality, reliability, or security of such third-party extensions.
220
+
221
+
### Update the workflow
222
+
223
+
Moving from a centralized version control system to Git is more than just migrating code. The team needs
224
+
training to understand how Git is different from the existing version control system and how these
225
+
differences affect day-to-day work.
226
+
227
+
Learn more about how to [migrate from centralized version control to Git](/devops/develop/git/centralized-to-git).
0 commit comments