-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnot-merged-to
More file actions
executable file
·34 lines (28 loc) · 1009 Bytes
/
Copy pathnot-merged-to
File metadata and controls
executable file
·34 lines (28 loc) · 1009 Bytes
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
34
#!/usr/bin/env bash
# Set strict mode
set -euo pipefail
# Main function wrapper
main() {
# Check if common-functions exists
if [[ ! -f "$(dirname "$0")/common-functions" ]]; then
echo "Downloading common-functions from GitHub..."
if ! curl -fsSL https://raw.githubusercontent.com/Flower7C3/bash-tools/master/common-functions -o "$(dirname "$0")/common-functions"; then
echo "Failed to download common-functions"
exit 1
fi
fi
# Source common functions
source "$(dirname "$0")/common-functions"
# Call the actual main function
check_main "$@"
}
check_main() {
BRANCH_TO_COMPARE="${1:-"main"}"
log_title "Branches not merged to '$BRANCH_TO_COMPARE' branch in '$(pwd)' path"
git branch --no-merged "$BRANCH_TO_COMPARE" | sed 's/^[* ]*//' | while read -r b; do
[ -z "$b" ] && continue
printf "%-50s\t%s\n" "$b" "$(git log -1 --format='#%h%x09[%ci]%x09%s' "$b")"
done
}
# Call main function
main "$@"