3 |
3 |
4 case ${1:-} in *help|-h) |
4 case ${1:-} in *help|-h) |
5 exec perldoc -T $0;; |
5 exec perldoc -T $0;; |
6 esac |
6 esac |
7 |
7 |
8 UPSTREAM="${1:-@{u}}" |
8 BRANCH="$(git symbolic-ref --short -q HEAD)" |
9 BRANCH="${2:-$(git symbolic-ref --short -q HEAD || echo HEAD)}" |
9 BASE=$(git merge-base "@{u}" "$BRANCH") |
10 |
10 |
11 [ "$#" -ne 0 ] && shift |
11 exec git rebase --interactive --autosquash "$@" "$BASE" "$BRANCH" |
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 |
12 |
22 :<<=cut |
13 :<<=cut |
23 =head1 NAME |
14 =head1 NAME |
24 |
15 |
25 git histedit |
16 git histedit |
28 |
19 |
29 $ git histedit |
20 $ git histedit |
30 |
21 |
31 =head1 DESCRIPTION |
22 =head1 DESCRIPTION |
32 |
23 |
33 C<histedit> lets you edit a branch using interactive rebase, but without |
24 C<histedit> lets you edit the current branch using interactive rebase, but |
34 actually I<moving> the fork point of your branch, avoiding the complications of |
25 without actually I<moving> the fork point of your branch, avoiding the |
35 fixing up your history and dealing with merge conflicts at the same time. |
26 complications of fixing up your history and dealing with merge conflicts at the |
|
27 same time. |
36 |
28 |
37 See also: C<hg histedit> |
29 See also: C<hg histedit> |
38 |
30 |
39 =cut |
31 =cut |