SVN / Git : side-by-side command reference
In our projects we use both SVN and Git and know how difficult sometimes it can be to mentally switch from one version control to another. As an aid, we created for you this hands-on SVN / Git side-by-side command reference:
SVN | Git | |
---|---|---|
Checkout from central repository | svn checkout https://www.labs64.com/ NetLicensingClient-java/trunk | git clone https://github.com/Labs64/ NetLicensingClient-csharp.git |
Update from central repository | svn update | git pull |
Push changes to central repository | svn commit -m "msg" file | git commit -m "msg" file;\ git push |
Push all changes to central repository | svn commit -m "msg" | git commit -a -m "msg";\ git push |
Show local changes | svn status | git status |
Diff local changes | svn diff file | git diff file |
Revert local changes | svn revert file | git checkout file |
Revert all local changes | svn revert . -R | git reset –hard HEAD |
Add new file | svn add file | git add file |
Add new folder recursively | svn add folder | git add folder |
Delete file | svn delete file | git rm file |
Delete folder | svn delete folder | git rm -r folder |
Ignore artifacts | svn propset svn:ignore "bin" .;\ svn commit -N -m "svn:ignore" . | echo "bin" > .gitignore;\ git commit -m "gitignore" .gitignore |
Of course, this reference does not contain all the commands available in Git and SVN, but it gives a brief overview on basic commands used in a daily work.