Skip to content

Commit 55d54c5

Browse files
committed
add git-fixup and git-squash
1 parent 0d2c8aa commit 55d54c5

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

Diff for: .gitconfig

+3
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
pf = push --force-with-lease
3939
who = shortlog -ns --
4040
alpha = !~/src/git-alpha/git-alpha
41+
default-branch = !git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@'
42+
fixup = !git-fixup
43+
squash = !git-squash
4144
[core]
4245
excludesfile = ~/.gitignore
4346
editor = vim

Diff for: bin/git-fixup

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
3+
set -eu
4+
5+
default_branch=$(git default-branch)
6+
7+
git --no-pager log $default_branch.. --pretty=format:"%h %s" |
8+
selecta |
9+
awk '{print $1}' |
10+
{ read commit; git commit --fixup $commit; }

Diff for: bin/git-squash

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
3+
set -eu
4+
5+
default_branch=$(git default-branch)
6+
first_commit=$(git --no-pager log $default_branch.. --pretty=format:%h | tail -1)
7+
8+
git ri $first_commit~1

0 commit comments

Comments
 (0)