Skip to content

Instantly share code, notes, and snippets.

@searls
Created January 28, 2011 18:41
Show Gist options
  • Save searls/800714 to your computer and use it in GitHub Desktop.
Save searls/800714 to your computer and use it in GitHub Desktop.
#I highly recommend experimental gitx: http://brotherbard.com/blog/
#initial setup
git config --global core.autocrlf true
git svn clone -s https://path/to/repo cilp
cd cilp
git svn fetch
git svn show-ignore >> .git/info/exclude
#creating a branch to work on a feature for a production branch
# list the remote branches
git branch -r
# Usage: git checkout -b <feature name> [remote branch name]
git checkout -b my-feature-branch 1.8.0_branch
# Heads up! If git tells you that every line of dozens of files have changed, it's because many files are committed with Windows line breaks. Follow the instructions under "I just cloned and git says files have changed!" at this URL: http://help.github.com/dealing-with-lineendings/
# Task: committing work done in a topic branch to the remote svn production branch
git checkout my-feature-branch
#make & commit codez
git svn rebase
git checkout -b 1.8.0 1.8.0_branch
git merge --squash my-feature-branch
git commit -m 'Message!'
git svn rebase
git svn dcommit
git checkout my-feature-branch && git merge --no-ff 1.8.0
# Task: apply the changes to the 1.8 branch to the trunk
git checkout master
git cherry-pick 1.8.0
#fix conflicts and stage them
git commit -c 1.8.0
# Other great resources:
# http://www.viget.com/extend/effectively-using-git-with-subversion/
# http://www.jukie.net/bart/blog/svn-branches-in-git
# http://blog.experimentalworks.net/2009/03/merge-vs-rebase-a-deep-dive-into-the-mysteries-of-revision-control/
@tbugai
Copy link

tbugai commented Jan 28, 2011

A good idea is to add the following few lines to your .gitignore to keep from seeing unnecessary stuff in your gitx window (if you don't use gitx, you should).

target/
**/target/
.gitignore

@searls
Copy link
Author

searls commented Jan 28, 2011

Hey Tim,

This line here:
git svn show-ignore >> .git/info/exclude

Will convert the svn:ignore properties into entries in the .git/info/exclude. My understanding of .git/info/exclude is that it works just like .gitignore, except it doesn't track it. I didn't want to commit a .gitignore into the svn repository, so I went that route.

@tbugai
Copy link

tbugai commented Jan 28, 2011

Yes, it does. But GitX appears to only read .gitignore.

@searls
Copy link
Author

searls commented Jan 28, 2011

sadly I have to punt and say "works for me", as my gitx ignores the files :|

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment