/
SVN and Git Command Mappings
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