Today I found out just how easy it is to convert an SVN repository to Git without losing any commit history. Note that you will need git-svn (
apt-get install git-svn on Debian/Ubuntu).
git svn clone http://mysvnrepo.com/my-project my-project
git remote add origin email@example.com:/my-project.git
git push origin master
Et voilà, my-project.git has the full commit history of the my-project SVN repository.
If anybody knows whether SVN branches can be converted to Git branches, please get in touch!
Name and email address
Each commit you make has your name and email address attached to it. Git will automatically configure these based on your username and hostname, but this information is usually not a good identifier. It is a good idea to set your real name and email address so that your commits can be identified easily.
git config --global user.name "Your Name"
git config --global user.email firstname.lastname@example.org
Global ignore file
Often there are files or directories that you want to ignore in all your Git projects. These are probably created automatically by your IDE, or ‘junk’ files created by the operating system. Here’s a sample global ignore file (I use PhpStorm, which creates an
.idea directory in the root of each project): Continue reading
archive command is basically the equivalent of SVN’s
export – it dumps a copy of the entire repository without any of the version control files, making it perfect for deploying to a testing or production server. Continue reading