-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgit-logb
executable file
·33 lines (25 loc) · 960 Bytes
/
git-logb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
# Copyright (c) 2019-2020 Benjamin Holt -- MIT License
# Prints log of all changes on the current branch back to the branch point
if [ "$1" == "-h" -o "$1" == "--help" ]; then
cat <<USAGE
usage: git logb [PARENT] Prints short logs of all changes on the current
branch ending with the commit that was branched;
PARENT defaults to "master".
git logb -h|--help Print this message and exit
USAGE
exit 0
fi
# Bold=`tput bold`
# Off=`tput sgr0`
ConfigBranch=`git config bettergit.defaultbranch`
: ${DefaultBranch:=${ConfigBranch:-"master"}}
Parent="${1:-${DefaultBranch}}"
BranchName=`git rev-parse --abbrev-ref HEAD`
if [ "$Parent" == "$BranchName" ]; then
echo "Cannot log $BranchName relative to itself" 1>&2
exit 1
fi
BranchPoint=`git merge-base "$Parent" "$BranchName"`
git log "$BranchPoint~1..HEAD" --format=oneline --abbrev-commit # Include branched commit
###