git swap - swaps top two commits; git drop [revision] - nukes that revision (or HEAD); git hoist <revision> - rebases that revision to be the most recent commit, so you can tweak it
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
swap = "!GIT_SEQUENCE_EDITOR=\"sed -i '' -n 'h;1n;2p;g;p'\" git rebase -i HEAD~2" | |
drop = "!f() { GIT_SEQUENCE_EDITOR=\"sed -i '' '/^pick '$(git log -n 1 --pretty='%h' ${1:-HEAD})/d\" git rebase -i ${1:-HEAD}^^; }; f" | |
hoist = "!f() { GIT_SEQUENCE_EDITOR=\"git log -n 1 --pretty='pick %h' $1|~/bin/hoist-lines.pike\" git rebase -i $1^; }; f" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env pike | |
// hoist-lines <filename> (un)hoists stdin-prefixed lines to the end in filename | |
int main(int argc, array argv) { | |
string prefix = Stdio.stdin.read() - "\n"; | |
string fn = argv[1]; | |
array end = ({""}); | |
array all = (Stdio.read_file(fn) / "\n") - end; | |
array hoist = Array.filter(all, has_prefix, prefix); | |
Stdio.write_file(fn, ((all - hoist) + hoist + end) * "\n"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment