Tue, 10 Sep 2019 13:55:57 -0500
lets use cpm
755 | 1 | #!/bin/sh |
2 | set -eu | |
3 | ||
4 | case ${1:-} in *help|-h) | |
5 | exec perldoc -T $0;; | |
6 | esac | |
7 | ||
759 | 8 | UPSTREAM="${1:-@{u}}" |
755 | 9 | BRANCH="${2:-$(git symbolic-ref --short -q HEAD || echo HEAD)}" |
10 | ||
11 | [ "$#" -ne 0 ] && shift | |
12 | [ "$#" -ne 0 ] && shift | |
13 | ||
14 | if git merge-base --is-ancestor "$UPSTREAM" "$BRANCH"; then | |
15 | BASE=$(git rev-parse "$UPSTREAM") | |
16 | else | |
17 | BASE=$(git merge-base "$UPSTREAM" "$BRANCH") | |
18 | fi | |
19 | ||
20 | exec git rebase --interactive --autosquash "$BASE" "$BRANCH" "$@" | |
21 | ||
22 | :<<=cut | |
23 | =head1 NAME | |
24 | ||
25 | git histedit | |
26 | ||
27 | =head1 SYNOPSIS | |
28 | ||
29 | $ git histedit | |
30 | ||
31 | =head1 DESCRIPTION | |
32 | ||
33 | C<histedit> lets you edit a branch using interactive rebase, but without | |
34 | actually I<moving> the fork point of your branch, avoiding the complications of | |
35 | fixing up your history and dealing with merge conflicts at the same time. | |
36 | ||
37 | See also: C<hg histedit> | |
38 | ||
39 | =cut |