How to Use Git With SVN: Harmonizing Version Control

Written by kaiser937426 | Published 2024/02/06
Tech Story Tags: git | svn | version-control | svn-guide | tortoisesvn | programming-tutorial | software-development | using-git-and-svn

TLDRTortoiseSVN and Git can work independently without conflict. Use these steps to set up your project to use both versions control systems. You can use Git during development while still adhering to your company's version control regulations. For more information on how to use Git with SVN, see the Git and SVN guide.via the TL;DR App

If you're familiar with Git's powerful features and prefer using it for your development process, but your company uses SVN (specifically TortoiseSVN) for version control, you might wonder if you can use both. Good news: you can. They can work independently without conflict. We'll guide you on how to use Git alongside SVN.

The 4 Steps to Follow

  • Step 1: Checkout Project with SVN:
    • Start by checking out the project from SVN. Once you've done this, you will notice a .svn hidden folder in your project directory. This is where SVN keeps track of its version control information.

  • Step 2: Initialize Git:
    • Navigate to the root of your project directory using your terminal, and initiate a Git repository by running the git init command. This creates a .git hidden folder, where Git stores its version control information.

  • Step 3: Configure Git to Ignore SVN:
    • Create a .gitignore file in your project root directory to instruct Git to ignore certain files. To do this, use the touch .gitignore command, and open it for editing. Add /.svn/ to the .gitignore file. This line tells Git to ignore the SVN version control files. You can check for success with the command git status --ignored.

  • Step 4: Configure SVN to Ignore Git:
    • Similarly, you need to tell SVN to ignore Git's version control files. To do this, add the .git folder and the .gitignore file to SVN's ignore list. This can be done through the TortoiseSVN context menu. Refer to Figures 1 and 2 for detailed steps.

Now, you have successfully set up your project to use both Git and SVN simultaneously, each ignoring the version control files of the other. You can now enjoy the features of Git during development while still adhering to your company's version control regulations.


Also published here


Written by kaiser937426 | Some notes on programming
Published by HackerNoon on 2024/02/06