|
Checkout an SVN repository
|
git svn clone -s <url_to_svn_repo> [--prefix=origin/] |
The -s option is used to specify that the SVN repo has the standard file tree; the
--prefix option specifies the prefix for remote branches naming |
|
Reflect & track remote ignores
|
git svn show-ignore > .gitignore |
|
|
Add file/stage changes
|
git add <file> [--all] |
The command is recursive; the
--all option forces to stage deletions |
|
Commit staged changes
|
git commit [-m <message>] |
|
|
Add and commit all changes
|
git commit -a [-m <message>] |
|
|
Commit changes to the SVN repo
|
git svn dcommit [--rmdir] |
The
--rmdir option forces the deletion of empty directories |
|
Revert unstaged changes
|
git checkout <file> |
|
|
Revert staged changes
|
git reset HEAD <file> |
|
|
Revert committed changes
|
git revert <rev_hash> |
The revision hash can be
HEAD if you want to undo your latest commit (see the documentation of the revert subcommand for additional detail |
|
Create a branch on the SVN repo
|
git svn branch <branch_name> [--parents] |
This has to be done if you want the branch to be committed to the SVN repo; the
--parents option forces the creation of parent directories if needed |
|
Create a local git branch based on an existing SVN branch
|
git checkout -b <local_branch> <svn_branch> |
This will keep both branches in sync
|
git svn info when you want to push modifications to an SVN branch to make sure you are committing to the appropriate branch: a broken SVN repo is hard to fix.
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.