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 thetouch .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 commandgit 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.
- Similarly, you need to tell SVN to ignore Git's version control files. To do this, add the
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