Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
add git-fixup and git-squash
  • Loading branch information
koffeinfrei committed Sep 19, 2018
1 parent 0d2c8aa commit 55d54c5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitconfig
Expand Up @@ -38,6 +38,9 @@
pf = push --force-with-lease
who = shortlog -ns --
alpha = !~/src/git-alpha/git-alpha
default-branch = !git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@'
fixup = !git-fixup
squash = !git-squash
[core]
excludesfile = ~/.gitignore
editor = vim
Expand Down
10 changes: 10 additions & 0 deletions bin/git-fixup
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

set -eu

default_branch=$(git default-branch)

git --no-pager log $default_branch.. --pretty=format:"%h %s" |
selecta |
awk '{print $1}' |
{ read commit; git commit --fixup $commit; }
8 changes: 8 additions & 0 deletions bin/git-squash
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

set -eu

default_branch=$(git default-branch)
first_commit=$(git --no-pager log $default_branch.. --pretty=format:%h | tail -1)

git ri $first_commit~1

0 comments on commit 55d54c5

Please sign in to comment.