Re: RFD: best way to automatically rewrite a git DAG as a linear history?

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

 



On Thu, Feb 18, 2010 at 12:11 AM, Jeff King <peff@xxxxxxxx> wrote:
> One simple strategy would be to squash all side-branch development into
> a single commit.

Something like this (replace MY_START_BRANCH with your starting
branch, and do this in a clone of your repository so you don't destroy
anything by accident):

        parent=""
        git rev-list --first-parent --reverse  | while read commit; do
                if [ -z "$parent" ]; then
                        git checkout -f $commit
                        git clean -fdx
                else
                        git diff $parent $commit | git apply --index
                        git commit -C $commit
                fi
                parent=$commit
        done

Have fun,

Avery
--
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]