SVN and Git Command Mappings
Tables of Commands
Table 1 provides a mapping between Subversion commands and Git commands. Â For the Subversion side, I'm using GMAT's URL at SourceForge when a URL is needed. Â This table is compiled from several reference websites, listed in the references
Task | Subversion Command | Corresponding Git Command | Comments |
---|---|---|---|
Check out the repository | svn checkout --username=<username> https://svn.code.sf.net/p/gmat/code/trunk GmatDevelopment | git clone git://URLNeededHere GMATDevelopment | Svn: Creates a local working copy in the folder GmatDevelopment Git: Creates a local repository in the folder GmatDevelopment |
Update locally checked out files | svn update | git pull | Svn: Retrieves updates and places them in the local working copy Git: Merges updates into the local repository |
Commit Files Locally | N/A | git add <list of changed or new files> Â git commit | Recommended practice is to commit often locally, so that you have a local history of the changes as you make then, and so that you can revert changes if necessary. |
Add files to the main repo | svn commit | git push | Â |
List local changes | svn stat | git status | Â |
Compare changes to committed files | svn diff somefile.txt | git diff somefile.txt | Â |
Revert a local change | svn revert somefile.txt | git checkout somefile.txt | Â |
Revert all local changes | svn revert . -R | git reset --hard HEAD | Â |
Add files to the repository | svn add file.txt | git add file.txt | Â |
Task | Git command | Comments |
---|---|---|
Stage Files | git add <list of changed or new files> | Prepares modified files for a commit  |
Stage and commit Files Locally | git commit -a | Â |
 |  |  |
References
Â