Re: simple (and probably trivial) git question about cumulative patches

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

 



On Thu, Nov 01, 2007 at 02:38:24AM +0100, Rene Herman wrote:
> If you do really want to redo patches that are further down even within a 
> single topic, git doesn't provide much added value over any other system I 
> believe, but I suspect that you just have lots of unrelated stuff and 
> haven't been making extensive use of branching?

 A) Edit non-HEAD patch (e.g 5th patch from the top):

    git checkout -b tmp HEAD~5
    git reset HEAD^
    $EDIT file.c
    git commit -a -c ORIG_HEAD
    git rebase --onto tmp master~5 master
    git branch -D tmp

 (you can try to write a script if you need it really often)

 B) Remove non-HEAD patch:

    git checkout -f -b tmp badcommit^
    git rebase --onto badcommit yourbranch
    git branch -d tmp


 --- my git-rmcommit script ----

#!/bin/bash

CID="$1"

if [ -z "$CID" ]; then
	echo "Usage: $0 <commit>"
	exit 1
fi

MYBRANCH=$(git branch | gawk '/^\* / { print $2 }')
TMPBRANCH="tmp.$$"

echo "Removing commit $CID from $MYBRANCH..."
echo

git checkout -f -b "$TMPBRANCH" "$CID"^
git rebase --onto "$TMPBRANCH" "$CID" "$MYBRANCH"
git branch -d "$TMPBRANCH"

echo "done."


-- 
 Karel Zak  <kzak@xxxxxxxxxx>

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux