Git for SVN Users
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.
- 1 Basic Tasks
- 1.1 Help
- 1.2 View content of remote repository (svn list)
- 1.3 Checkout code
- 1.4 Get updates
- 1.5 Compare working copy to head (what have I changed?)
- 1.6 Add new file(s)/folder(s) to version control
- 1.7 Delete file(s)/folder(s)
- 1.8 Ignore certain file(s)/folder(s)
- 1.9 Commit changes with comment (all or some of changes in working copy)
- 1.10 Get basic information about working copy (svn info)
- 1.11 Revert changes (all or some changes in working copy)
- 1.12 Create a patch (diff of working copy from head)
- 1.13 Apply a patch
- 1.14 Resolve conflicts
- 1.15 Create a branch (e.g., space for new module)
- 1.16 Close a branch
- 1.17 Tag a release
- 2 Advanced Tasks
- 3 See Also
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 --track 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 |
---|---|
| |
You can list out existing tags with git tag
or search for a specific tag with git tag -l 1.9.
*
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
ProGit - free eBook
Eric Sink's Version Control by Example
Introduction to git - with video, from Github learning course
Useful aliases for git: https://gist.github.com/3147055
Git intro tutorial: http://gitimmersion.com