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

TaskSubversion CommandCorresponding Git CommandComments
Check out the repositorysvn checkout --username=<username> https://svn.code.sf.net/p/gmat/code/trunk GmatDevelopmentgit 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 filessvn updategit pull

Svn: Retrieves updates and places them in the local working copy

Git: Merges updates into the local repository

Commit Files LocallyN/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 reposvn commitgit push 
List local changessvn statgit status 
Compare changes to committed filessvn diff somefile.txtgit diff somefile.txt 
Revert a local changesvn revert somefile.txtgit checkout somefile.txt 
Revert all local changessvn revert . -Rgit reset --hard HEAD 
Add files to the repositorysvn add file.txtgit add file.txt 
TaskGit commandComments
Stage Files

git add <list of changed or new files>

Prepares modified files for a commit

 

Stage and commit Files Locallygit commit -a 
   

References

Â