svn

Tag archives:

Git and SVN Notes

More for my own reference than anything else…

I have an SVN repository cloned locally. I’ve made a couple of changes in order for my application to run locally and I committed those all against the “dev” branch I set up.

I then go off and do some actual work, which then needs to get sent back upstream to SVN. This is my workflow.

Starting in the dev branch, with all of my changes committed…

  1. Because I should be making sure I have the newest stuff from SVN, just in case
    git svn rebase
  2. Switch over to the master, which should mimic SVN
    git checkout master
  3. Bring master up to date with the dev branch
    git rebase dev
  4. Remove the commits I don’t want to push back to SVN
    git rebase -i git-svn
  5. Because I’m paranoid and want to make sure only the commits I want are actually coming through
    git svn dcommit --dry-run
  6. Commit it off to SVN
    git svn dcommit

Changing History

Revise the last 37 commits. Opens up a log in $EDITOR where you can ‘squash’ commits together
git rebase -i HEAD~37

Undoing crazy rebases

  1. Find the commit you want to bring back, copy it’s sha1 starter
    git reflog
  2. Boom, commit is back.
    git cherry-pick <sha1 starter></sha1>