Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 15 Next »

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 – leave a comment at the bottom with suggested changes/additions.  Thank you!

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

git help______________

svn help{{______________

View content of remote repository (svn list)

Git

SVN

Browse on github______________

svn list http://svn.openmrs.org/openmrs/trunk/______________

You can browse files in your local repository with git show or git ls-files.

Checkout code

Git

SVN

git clone git@github.com:username/openmrs-module-mymodule.git_____

svn checkout http://svn.openmrs.org/openmrs-modules/mymodule mymodule_______

Get updates

Git

SVN

git pull______________

svn update______________

Compare working copy to head (what have I changed?)

Git

SVN

git xxx______________

svn diff______________

Add new file(s)/folder(s) to version control

Git

SVN

git add myfile.txt______________

svn add myfile.txt______________

Delete file(s)/folder(s)

Git

SVN

rm myfile.txt
 
To remove from Git's index & add to Git ignore:
git rm --cached myfile.txt

To remove from Git's index (doesn't delete file):
git rm myfile.txt______________

svn rm myfile.txt______________

Ignore certain file(s)/folder(s)

Git

SVN

.gitignore______________

svn propset svn:ignore -F .svnignore .______________

Commit changes with comment (all or some of changes in working copy)

Git

SVN

git commit -m "comment"______________
git push
Note: It is better to use the command "git commit -a --signoff", which will open an editor using which you should write the commit comment.
This commit would be used as an email message and a subject and the format goes something like:
* First line is used as the subject
* Second line onwards is used as the body of the message
The --signoff option add the text:
"Signed-off-by: My Name <myemail@example.com>"
This signoff statement becomes part of the comment and will be used to track the changes done and also the copyright owners of the changes

svn commit -m "comment"______________

Get basic information about working copy (svn info)

Git

SVN

cat .git/config ______________

svn info______________

Revert changes (all or some changes in working copy)

Git

SVN

git xxx______________

svn xxx______________

Create a patch (diff of working copy from head)

Git

SVN

git format-patch master --stdout > my_change.patch______________

svn xxx______________

Apply a patch

Git

SVN

git apply --stat my_change.patch______________

svn xxx______________

Resolve conflicts

Git

SVN

git xxx______________

svn xxx______________

Create a branch (e.g., space for new module)

Git

SVN

git xxx______________

svn xxx______________

Close a branch

Git

SVN

git xxx______________

svn xxx______________

Tag a release

Git

SVN

git xxx______________

svn xxx______________

Advanced Tasks

Switch working copy to new repository location

Git

SVN

git xxx______________

svn xxx______________

Detach working copy

Git

SVN

git xxx______________

svn export newlocation______________

Blame (show annotations / show who changed what line in what commit)

Git

SVN

git xxx______________

svn xxx______________

Show history

Git

SVN

git log______________

svn log______________

Switch to earlier revision

Git

SVN

git xxx______________

svn xxx______________

Correct/change old commit message

Git

SVN

git xxx______________

svn xxx______________

See Also

  • No labels