Migrate project repo from TFS to DevOps
Read the page below:
How-to migrate project from TFVC to Git by using Git-TFS
2. Run PowerShell as Administrator
3. Create a folder on your pc to add projects.
First, go to C:\ with the command below:
cd\
and after, create your default folder.
4. Go to TFS and find your project.
NOTE: Itโs important that your project have branches
5. In your PowerShell, create a new folder with the name of the project that will be migrated.
6. Create a folder for each branch
7. Enter the folder of the branch to be migrated. For example if we want to do Git TFS Clone on Main, we should enter the Main folder and run the command in Step 9
cd Main
ย
8. Go to DevOps and create a new repository with the name of your project.
NOTE: Don't add a README
ย
9. Execute the command below, changing the data referring to your project and the command is run in the appropriate folder
git tfs clone http://tfsprod:8080/tfs/CivAv/ $/CADLIS-SILDAC/Main C:\devops\migration\CADLIS-SILDAC\Main
$/CADLIS-SILDAC/Main
- the path of your branch in the project's TFS
C:\devops\migration\CADLIS-SILDAC\Main
- the path created in your pc
*This step may take a while, as the entire project with the history is being copied.
ย
10. Copy the command on DevOps and run it in PowerShell
ย
11. Add a branch
ย
12. Push to DevOps
ย
If above steps fail to copy over any/latest files, please follow the instructions below:
Go to TFS and in a branch select Download as Zip
Extract the files in your local machine
Copy all files in your branch folder via Windows Explorer, still keep .git folder which was created by previous โgif tfs cloneโ command
Go to PowerShell and execute the commands
Will show the list of files being copied in the PowerShell screen
Copy the commit ID in the first row below the command
ย
Execute the command with the commit ID copied (the commit ID besides your name only)
ย
Push to DevOps again
ย
If there is any error like โorigin does not appear to be a git repository', i.e we need to add an origin before to do the git push command, please see the โgit remote add origin..โ section
ย
13. Update the information about the new repository in Confluence. Go to the project page and add 2 new rows. See below:
ย
**Notes: If the repo has a .NET version as well as the regular version, setting up the names as the following is recommended:
FINAL STEP: Add .gitignore to the source folder.
File found here: gitignore/VisualStudio.gitignore at main ยท github/gitignore
Since the dev branch cannot be updated directly, you will need to add the file in a feature branch.
Open VS2019
Clone/open the project you are working on
Create a new feature branch from the remote dev branch
Naming convention: feature/pbinumber-gitignore
Ensure you are on this new branch, then in the top menu, choose Git โ Settings โ Source Control โ Git Repository Settings โ Click to add an Ignore file โ Click OK
Open Git Changes, add your commit message, then commit and push
Create the pull request, from your feature branch to the dev branch
After the pull request is approved, complete it to merge the changes into dev