Skip to Content.
Sympa Menu

sm-discuss - Re: [SM-Discuss] git: cherry-pick whole directories

sm-discuss AT lists.ibiblio.org

Subject: Public SourceMage Discussion List

List archive

Chronological Thread  
  • From: Jaka Kranjc <lynx AT mages.ath.cx>
  • To: sm-discuss AT lists.ibiblio.org
  • Subject: Re: [SM-Discuss] git: cherry-pick whole directories
  • Date: Wed, 24 Jan 2007 15:13:07 +0100

On Monday 22 January 2007 07:28, Jeremy Blosser wrote:
> > Another thing about this approach is it only works if we assume each
> > commit only affected the directory in question...
I thought of a way how to deal with this.

path="$1"
master=${2:-master}
for i in $path; do
[[ -e $i ]] || { echo bad path: $i; exit 1; }
done
git log --pretty=one-line HEAD..$master $path
echo "Cut and paste desired commits below, then ctrl-D"
while read commit junk; do
git-cherry-pick -n $commit || {
echo
echo fix the conflict
echo and run git commit -F .msg $path; git reset --hard
echo then restart me
exit 123; } &&
git commit -F .msg $path
git reset --hard
done

Not sure if the .msg is available (didn't try it at all yet) and it also
requires a clean working tree, which is not a problem though, since you need
one to be able to cherry-pick in the first place. It also allows the
specifying of multiple paths (think spell updates that also change Changelog
or accounts/groups).

In the final script, I'd make it try a modified automatic approach first and
if it works - great, otherwise fallback to this.

--
We cannot command nature except by obeying her. --Sir Francis Bacon
Have a sourcerous day! www.sourcemage.org

Attachment: pgpTEcKUDasCn.pgp
Description: PGP signature




Archive powered by MHonArc 2.6.24.

Top of Page