Re: Recording cherry-picked commits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



What about using a hidden ".gitcherry" file in the current branch to
store the commits that have been applied?  With the simple shell
scripts below I'm able to achieve the same effect as svnmerge:


Wrapper around git-cherry-pick:
------------------------------------------------------------------------
#! /bin/sh -e

# Write the commit in .gitcherry, stage .gitcherry for commit and call
# git-cherry-pick.  If a conflict occurs, resolve it and invoke this script with
# --continue, in order to commit with the original author and commit message

if test "$1" = "--continue" ; then
    cont=1
    commit=$(tail -1 .gitcherry)
else
    cont=0
    commit=$1
fi

if test $cont = 0 ; then
    echo $commit >> .gitcherry
    git add .gitcherry
    git cherry-pick $commit
else
    git commit -c $commit
fi
-------------------------------------------------------------------------


Wrapper around git-cherry:
------------------------------------------------------------------------
#! /bin/sh -e

# List all commits with git-cherry and exclude all the ones that are specified
# in .gitcherry.  For each commit, invoke 'git show' to print the commit message

for commit in $(git-cherry $* | sed -ne 's/^+ //p' | grep -v -f .gitcherry) ; do
    git show -s --pretty=format:"%H %s" $commit
done
------------------------------------------------------------------------

WDYT?
-- 
Jean-Baptiste Quenot
http://caraldi.com/jbq/blog/
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux