Wednesday, March 26, 2008

fixing dcommit maddness

when pushing changes from git back to the svn dcommit by default does a rebase afterwards, which causes all the time stamps of the checkins in the git log to change to the dcommit time, which is really annoying. reset can be used to get the times back, but then dcommit wont work since they're not synced. To get around this you have to use rebase before the dcommit, then reset again.

git commit
git svn rebase
git svn dcommit --no-rebase
git reflog
git reset --hard HEAD@{5}
reflog is used to list all the changes to a branch and find out the number to use between the braces in the reset command. The number you're looking for is the one of the last commit.

Unfortunately this needs to be done every time I want to push back to svn now. I would hope that using --no-rebase on every dcommit would have avoided this, but I can't test it now without messing up my repos.