mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-17 22:32:58 +02:00
branches shell script
This commit is contained in:
parent
4b511863f9
commit
b24632caf6
17
get_branches.sh
Executable file
17
get_branches.sh
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
git reflog -n100 --pretty='%cr|%gs' --grep-reflog='checkout: moving' HEAD | {
|
||||||
|
seen=":"
|
||||||
|
git_dir="$(git rev-parse --git-dir)"
|
||||||
|
while read line; do
|
||||||
|
date="${line%%|*}"
|
||||||
|
branch="${line##* }"
|
||||||
|
if ! [[ $seen == *:"${branch}":* ]]; then
|
||||||
|
seen="${seen}${branch}:"
|
||||||
|
if [ -f "${git_dir}/refs/heads/${branch}" ]; then
|
||||||
|
printf "%s\t%s\n" "$date" "$branch"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
} | sed 's/ days /d /g' | sed 's/ weeks /w /g' | sed 's/ago//g' | tr -d ' '
|
Loading…
x
Reference in New Issue
Block a user