{"thread":{"id":"22602","subject":"cherry-pick from a branch to another with git-svn automatically stripping git-svn-id from commit message","startedAt":"2010-02-10T15:44:54Z","lastAt":"2010-02-10T15:44:54Z","messageCount":1,"participants":["Daniele Segato"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"134145","messageId":"9accb4401002100744o73a347e0pe86e706bcd2b04be@mail.gmail.com","threadId":"22602","inReplyTo":null,"subject":"cherry-pick from a branch to another with git-svn automatically stripping git-svn-id from commit message","fromName":"Daniele Segato","fromEmail":"daniele.bilug@gmail.com","sentAt":"2010-02-10T15:44:54Z","receivedAt":"2010-02-10T15:44:54Z","isPatch":false,"sender":{"key":"daniele.bilug@gmail.com","avatar":null},"body":"Hi,\n\nsince git-svn modify the commit message when you dcommit something\n(git svn dcommit)\nand then use the commit message to decide which is the branch to\ndcommit next cherry-pick-ing\n(and other commands) has some problem when you work through different\nsvn branch.\n\nExample, you have 2 remote branch: remote/trunk, remote/v1.x\nand you are following them with two branches: trunk and v1.x\n\nnow say you want to cherry-pick a commit from trunk into v1.x locally\nto dcommit it onto the remote/v1.x branch.\n\nthe step you had to do are:\ngit cherry-pick <your-commit-hash-on-trunk>\ngit commit --amend # removing the line starting with git-svn-id\n# or add the -e option to cherry-pick instead of amending\ngit svn dcommit\n\n\nnow, if you have to do it frequently it is a bit annoying and you man\ndo some mistake.\n\nI want to make it automatic and easy to use like:\n\ngit cherry-pick-svn <your-commit-hash-on-trunk>\ngit svn dcommit\n\nwith an alias.\n\non #irc charon suggested me to use !GIT_EDITOR=\"script that strip the\ngit-svn-id here\" git cherry-pick ...\n\nso I tried this from command line (hash is just a random one):\n\nGIT_EDITOR=\"sed -i '/^git-svn-id:/d'\" git cherry-pick -e 9eb6b7de\n\nit works.\n\nso I opened my ~/.gitconfig and added this alias:\n\n[alias]\n\tcherry-pick-svn =  !GIT_EDITOR=\"sed -i '/^git-svn-id:/d'\" git cherry-pick -e\n\n\nbut with\n$ git cherry-pick-svn 9eb6b7de\nI get:\nsh: -i: command not found\nfatal: Failed to run 'GIT_EDITOR=sed -i -e '/^git-svn-id:/d' git\ncherry-pick -e '9eb6b7de...'' when expanding alias 'cherry-pick-svn'\n\n\nbut modifying it with this:\n[alias]\n\tcherry-pick-svn =  !GIT_EDITOR='sed -i /^git-svn-id:/d' git cherry-pick -e\n\nmade it working.\n\nI just want to share this with you if someone need it.\n\nAnd may be ask if you find any problem with this or if you have a\nbetter way to do it\n\nRegards,\nDaniele\n"}]}