git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniele Segato <daniele.bilug@gmail.com>
To: git@vger.kernel.org
Subject: cherry-pick from a branch to another with git-svn automatically  stripping git-svn-id from commit message
Date: Wed, 10 Feb 2010 16:44:54 +0100	[thread overview]
Message-ID: <9accb4401002100744o73a347e0pe86e706bcd2b04be@mail.gmail.com> (raw)

Hi,

since git-svn modify the commit message when you dcommit something
(git svn dcommit)
and then use the commit message to decide which is the branch to
dcommit next cherry-pick-ing
(and other commands) has some problem when you work through different
svn branch.

Example, you have 2 remote branch: remote/trunk, remote/v1.x
and you are following them with two branches: trunk and v1.x

now say you want to cherry-pick a commit from trunk into v1.x locally
to dcommit it onto the remote/v1.x branch.

the step you had to do are:
git cherry-pick <your-commit-hash-on-trunk>
git commit --amend # removing the line starting with git-svn-id
# or add the -e option to cherry-pick instead of amending
git svn dcommit


now, if you have to do it frequently it is a bit annoying and you man
do some mistake.

I want to make it automatic and easy to use like:

git cherry-pick-svn <your-commit-hash-on-trunk>
git svn dcommit

with an alias.

on #irc charon suggested me to use !GIT_EDITOR="script that strip the
git-svn-id here" git cherry-pick ...

so I tried this from command line (hash is just a random one):

GIT_EDITOR="sed -i '/^git-svn-id:/d'" git cherry-pick -e 9eb6b7de

it works.

so I opened my ~/.gitconfig and added this alias:

[alias]
	cherry-pick-svn =  !GIT_EDITOR="sed -i '/^git-svn-id:/d'" git cherry-pick -e


but with
$ git cherry-pick-svn 9eb6b7de
I get:
sh: -i: command not found
fatal: Failed to run 'GIT_EDITOR=sed -i -e '/^git-svn-id:/d' git
cherry-pick -e '9eb6b7de...'' when expanding alias 'cherry-pick-svn'


but modifying it with this:
[alias]
	cherry-pick-svn =  !GIT_EDITOR='sed -i /^git-svn-id:/d' git cherry-pick -e

made it working.

I just want to share this with you if someone need it.

And may be ask if you find any problem with this or if you have a
better way to do it

Regards,
Daniele

                 reply	other threads:[~2010-02-10 15:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9accb4401002100744o73a347e0pe86e706bcd2b04be@mail.gmail.com \
    --to=daniele.bilug@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).