Git-svn for Beginners Cheat Sheet

A Programming › Git cheat sheet in English by ezk

The basic use cases for interacting with svn using git. (Based on http://viget.com/extend/effectively-using-git-with-subversion )

26,716 views 5,843 downloads 22 Jan 2013 History
4.9 avg · 9 ratings

Setting up a git svn working copy

Checkout standard repository
git svn clone -s svn-url local-dir
Reflect & track remote ignores
git svn show-i­gnore > .gitignore
Reflect remote ignores
git svn show-i­gnore >> .git/i­nfo­/ex­clude

Normal git workflow

Add file/stage changes (recur­sive)
git add file
Remove file
git rm [-r] file
Intera­ctively stage changes
git add -i
Revert unstaged changes
git checkout file
Revert staged changes
git reset HEAD file
Commit staged changes
git commit
Add and commit all changes
git commit -a

Working with branches

Create new branch
git branch new-branch [old-branch]
Move to a branch
git checkout branch
Create and move to new branch
git checkout -b new-branch [old-branch]
List local branches
git branch
List local and remote (svn) branches
git branch -a
Merging a branch to current branch
git merge other-­branch
Merge a branch as single commit
git merge --squash other-­branch

Updating from and committing to svn

Apply remote changes to local repo
git svn rebase
Commit changes back to Subversion
git svn dcommit

Badges

Useful Cheat Sheet Nice Cheat Sheet Good Cheat Sheet Appreciated Cheat Sheet Downloaded from Unusual Locations × 2

Comments

No comments yet.

Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.