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.
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.
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.
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
.
.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