Git vs. SVN Commands

Here is a col­lec­tion of com­mands in both Git and SVN. This col­lec­tion is not com­pre­hen­sive; it’s only to give a basic under­stand­ing of how the dif­fer­ent com­mands trans­late between the two systems.

Cre­at­ing a Repos­i­to­ry #

git init .
git add .
git commit -m "added new files to repository"
svnadmin create <repo>
svn import file://<files>

Cloning or Check­ing Out a Repos­i­to­ry #

git clone <repository>
svn checkout <url>

Check­out and Track Remote Branch #

git checkout --track -b <branch> origin/<branch>
svn switch <url>

Update from Remote Repos­i­to­ry #

git pull origin <branch>
svn update

Com­mit Changes #

This assumes you are work­ing with a repository.

git commit -a -m "a commit message"
git push origin <branch>
svn commit

SVN looks a bit more effi­cient here but since Git doesn’t require a remote repos­i­to­ry, it doesn’t assume you want to push your changes.

Dis­play Log #

git log
svn log

Merge Branch­es #

git merge <branch>
svn merge -r 426:HEAD <url>/branches/<branch>

Cre­ate & List Tags #

git tag -a <tag-name>
git tag -l
svn copy <url>/trunk <URL>/tags/<tag-name>
svn list <url>/tags

Cre­ate & Check Out Branch­es #

git branch <branch>
git checkout <branch>
svn copy <url>/trunk <url>/branches/<branch>
svn switch <url>/branches/<branch>