Skip to content

Instantly share code, notes, and snippets.

@jodersky
Last active March 29, 2023 15:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jodersky/fb4247d26417a05074f6906138fc42f2 to your computer and use it in GitHub Desktop.
Save jodersky/fb4247d26417a05074f6906138fc42f2 to your computer and use it in GitHub Desktop.
A custom git script which is helpful if you work on many branches concurrently and forget their names
#!/bin/bash
USAGE="<pattern>"
LONG_USAGE="list most recently used branches that start with <pattern>"
# shellcheck source=/dev/null
. "$(git --exec-path)/git-sh-setup"
branches=$(git branch --sort=committerdate --list "$1*" --no-merged master --format='%(refname:short)'| tail -n 5)
for branch in $branches; do
echo -e "\033[1m$branch\033[0m"
echo "first: " "$(git log master.."$branch" --oneline | tail -1)"
echo "last: " "$(git log -1 "$branch" --oneline)"
echo ""
done
@jodersky
Copy link
Author

jodersky commented Mar 29, 2023

git wip jo

jo/branch1
first:  f20f8a0 configparse: factor out builder
last:   5c6d070 configparse: rename builder

jo/branch2
first:  c25fb23 Add configuration parsing module
last:   e18d151 configparse: extract docs from doc comments

jo/branch3
first:  6feb834 Refactor annotation-based API
last:   6feb834 Refactor annotation-based API

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment