mirror of
https://github.com/Stunkymonkey/dotfiles.git
synced 2025-09-13 22:12:04 +02:00
Add git automatic range diff
Co-authored-by: Felix Buehler <account@buehler.rocks>
This commit is contained in:
parent
21c425b441
commit
72ceb16f5f
2 changed files with 24 additions and 1 deletions
23
bin/git-ard.sh
Executable file
23
bin/git-ard.sh
Executable file
|
@ -0,0 +1,23 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Git automatic range diff
|
||||||
|
|
||||||
|
# Enforce being in a git repository
|
||||||
|
git rev-parse --is-inside-work-tree >/dev/null || exit $?
|
||||||
|
|
||||||
|
# We actually should check out the head branch via `git remote show ${REMOTE}`,
|
||||||
|
# but this requires active connection and active 2FA verification. Tedious to
|
||||||
|
# have multiple calls for this
|
||||||
|
if git rev-parse --verify main &>/dev/null; then
|
||||||
|
MAIN_BRANCH=main
|
||||||
|
else
|
||||||
|
MAIN_BRANCH=master
|
||||||
|
fi
|
||||||
|
|
||||||
|
CURRENT_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
|
||||||
|
GIT_REMOTE=origin
|
||||||
|
|
||||||
|
# Show the next command
|
||||||
|
set -x
|
||||||
|
|
||||||
|
git range-diff "${GIT_REMOTE}/${MAIN_BRANCH}..${GIT_REMOTE}/${CURRENT_BRANCH}" "${MAIN_BRANCH}..${CURRENT_BRANCH}"
|
|
@ -76,6 +76,7 @@
|
||||||
- link:
|
- link:
|
||||||
~/.local/bin/host-is-on: bin/host-is-on.sh
|
~/.local/bin/host-is-on: bin/host-is-on.sh
|
||||||
~/.local/bin/git-authors: bin/git-authors.sh
|
~/.local/bin/git-authors: bin/git-authors.sh
|
||||||
|
~/.local/bin/git-ard: bin/git-ard.sh
|
||||||
~/.local/bin/clean: bin/clean.sh
|
~/.local/bin/clean: bin/clean.sh
|
||||||
|
|
||||||
# systemd
|
# systemd
|
||||||
|
@ -88,4 +89,3 @@
|
||||||
|
|
||||||
- link:
|
- link:
|
||||||
~/.local/bin/diff-so-fancy: git/diff-so-fancy/diff-so-fancy
|
~/.local/bin/diff-so-fancy: git/diff-so-fancy/diff-so-fancy
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue