From d1eee308d3fba9cd318011f97f48e959f20e4982 Mon Sep 17 00:00:00 2001 From: Joe Block Date: Sat, 9 Mar 2019 08:29:55 -0700 Subject: [PATCH] Add Vengada Rangaraju's git-branch-rebaser --- README.md | 1 + bin/git-branch-rebaser | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100755 bin/git-branch-rebaser diff --git a/README.md b/README.md index 1ccb4285c..bf979f32e 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,7 @@ If you wrote one of these scripts and want it removed from this collection, plea | `git-age` | Kristoffer Gronlund's [wiki](https://github.com/krig/git-age/wiki) | A git-blame viewer, written using PyGTK.| | `git-attic` | Christian Neukirchen's [blog](http://chneukirchen.org/blog/archive/2013/01/a-grab-bag-of-git-tricks.html) | Displays a list of deleted files in your repo. The output is designed to be copy and pasted: Pass the second field to `git show` to display the file contents, or just select the hash without ^ to see the commit where removal happened. | | `git-big-file` | Mislav Marohnić's [dotfiles](https://github.com/mislav/dotfiles) | Show files in the repo larger than a threshold size. | +| `git-branch-rebaser` | Vengada Rangaraju | Kicks off an interactive rebase of all the commits on your branch. _Including pushed commits_, so be careful. | | `git-change-author` | Michael Demmer in [jut-io/git-scripts](https://github.com/jut-io/git-scripts/blob/master/bin/git-change-author) | Change one author/email in the history to another. | | `git-change-log` | John Wiegley's [git-scripts](https://github.com/jwiegley/git-scripts) | Transform `git log` output into a complete Changelog for projects that haven't been maintaining one. | | `git-changes` | Michael Markert's [dotfiles](https://github.com/cofi/dotfiles) | List authors in the repo in descending commit-count order. | diff --git a/bin/git-branch-rebaser b/bin/git-branch-rebaser new file mode 100755 index 000000000..4719bc2e8 --- /dev/null +++ b/bin/git-branch-rebaser @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +# +# Kicks off an interactive rebase of all the commits on your branch +# +# Copyright 2019, Vengada Rangaraju https://github.com/KarthikRangaraju +# License: Apache 2.0 + +set -o pipefail + +exec git rebase -i $(git rev-parse $(git log master..$(git rev-parse --abbrev-ref HEAD) --oneline | tail -1 | awk '{ print $1 }')^)