Linas Valiukas

Git (git-svn) nano-tutorial

Checkout

git svn clone -s http://example.com/my_subversion_repo local_dir
cd local_dir/
git repack -d
git svn show-ignore >> .git/info/exclude

Pull remote updates from SVN

git svn rebase

Push local updates to SVN

git svn dcommit

Make sure things are fine before pushing

git svn dcommit --dry-run

Branches

Create a SVN branch

git svn branch -m "Branch for authentication bug" auth_bug

Make sure things are fine before creating

git svn branch --dry-run -m "Branch for authentication bug" auth_bug

Create a local branch from SVN branch

git checkout -b local/auth_bug auth_bug

List branches

Local

git branch

Remote

git branch -r

Remove branches

Local

git branch -d branchname

Remote

git push origin :branchname

or

git branch -d -r branchname

Update a list of SVN branches

git svn fetch
git svn rebase

Merge

trunk -> branch

git checkout master
git svn rebase
git checkout extra_cool_branch
git merge --squash master
git commit -m "Bring branch up-to-date with trunk"
  

branch -> trunk

git checkout master
git svn rebase
git merge --squash extra_cool_feature
git commit -m "Merge branch into trunk"

Stash

Create

git stash

Show diff

git stash show -p

Apply

git stash pop   # delete the stash after applying
git stash apply # do not delete the stash after applying

Drop

git stash drop

Submodule

Add

git submodule add URL path
git submodule init
git submodule update

Remove

  1. Delete the relevant section from the .gitmodules file.
  2. Delete the relevant section from .git/config.
  3. Run git rm –cached path_to_submodule (no trailing slash).
  4. Commit and delete the now untracked submodule files.

Compress

git submodule foreach 'echo `git gc --aggressive`'
git-svn-nano-tutorial.txt · Last modified: 2013-10-28 16:01 by Linas Valiukas