This page is a work in progress. If you find an error or feel that you can make a contribution, please edit the page or – if you are not comfortable editing page – press the "M" key to leave a comment at the bottom with suggested changes/additions. Thank you! (note: you must be logged into the wiki to edit pages or add comments)
Most OpenMRS developers are comfortable with subversion and haven't had as much experience with Git. While there are a number of good tutorials on Git, we wanted to provide a quick reference for our developers.
Basic Tasks
Help
Git |
SVN |
---|---|
|
|
View content of remote repository (svn list)
Git |
SVN |
---|---|
|
|
You can browse files in your local repository with git show
or git ls-files
.
Checkout code
Git |
SVN |
---|---|
|
|
If there is a remote branch that you want to add to your local repository, use the command:
git checkout -b branchname origin/branchname
Get updates
Git |
SVN |
---|---|
|
|
Compare working copy to head (what have I changed?)
Git |
SVN |
---|---|
|
|
Add new file(s)/folder(s) to version control
Git |
SVN |
---|---|
|
|
Delete file(s)/folder(s)
Git |
SVN |
---|---|
|
|
Ignore certain file(s)/folder(s)
Git |
SVN |
---|---|
|
|
Commit changes with comment (all or some of changes in working copy)
Git |
SVN |
---|---|
|
|
Get basic information about working copy (svn info)
Git |
SVN |
---|---|
|
|
Revert changes (all or some changes in working copy)
Git |
SVN |
---|---|
|
|
Create a patch (diff of working copy from head)
Git |
SVN |
---|---|
|
|
Apply a patch
Git |
SVN |
---|---|
|
|
Resolve conflicts
Git |
SVN |
---|---|
|
|
Create a branch (e.g., space for new module)
Git |
SVN |
---|---|
|
|
Close a branch
Git |
SVN |
---|---|
|
|
Tag a release
Git |
SVN |
---|---|
|
|
Advanced Tasks
Switch working copy to new repository location
Git |
SVN |
---|---|
|
|
Detach working copy
Git |
SVN |
---|---|
|
|
Blame (show annotations / show who changed what line in what commit)
Git |
SVN |
---|---|
|
|
Show history
Git |
SVN |
---|---|
|
|
Switch to earlier revision
Git |
SVN |
---|---|
|
|
Correct/change old commit message
Git |
SVN |
---|---|
|
|
See Also
- Git - SVN Crash Course
- ProGit - free eBook
- Eric Sink's Version Control by Example
- Introduction to git - with video, from Github learning course