Git vs. SVN Commands
Here is a collection of commands in both Git and SVN. This collection is not comprehensive; it’s only to give a basic understanding of how the different commands translate between the two systems.
Creating a Repository #
git init .
git add .
git commit -m "added new files to repository"
svnadmin create <repo>
svn import file://<files>
Cloning or Checking Out a Repository #
git clone <repository>
svn checkout <url>
Checkout and Track Remote Branch #
git checkout --track -b <branch> origin/<branch>
svn switch <url>
Update from Remote Repository #
git pull origin <branch>
svn update
Commit Changes #
This assumes you are working with a repository.
git commit -a -m "a commit message"
git push origin <branch>
svn commit
SVN looks a bit more efficient here but since Git doesn’t require a remote repository, it doesn’t assume you want to push your changes.
Display Log #
git log
svn log
Merge Branches #
git merge <branch>
svn merge -r 426:HEAD <url>/branches/<branch>
Create & List Tags #
git tag -a <tag-name>
git tag -l
svn copy <url>/trunk <URL>/tags/<tag-name>
svn list <url>/tags
Create & Check Out Branches #
git branch <branch>
git checkout <branch>
svn copy <url>/trunk <url>/branches/<branch>
svn switch <url>/branches/<branch>