-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
259 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/usr/bin/env bash | ||
# A sorted prettier branch -vv | ||
|
||
if ! (( BASH_VERSINFO[0] > 4 || | ||
BASH_VERSINFO[0] == 4 && BASH_VERSINFO[1] >= 2 )); then | ||
printf >&2 'This script requires bash 4.2 or newer\n' | ||
exit 1 | ||
fi | ||
|
||
if [[ -t 1 ]]; then | ||
shopt -s checkwinsize | ||
COLUMNS=$(tput cols) | ||
color_branch_local=$(git config --get-color color.branch.local normal) | ||
color_branch_current=$(git config --get-color color.branch.current green) | ||
color_diff_commit=$(git config --get-color color.diff.commit yellow) | ||
color_branch_upstream=$(git config --get-color color.branch.upstream blue) | ||
reset=$(tput sgr0) | ||
fi | ||
|
||
|
||
declare -A upstream date hash message | ||
eval "$( | ||
git for-each-ref --format='upstream[%(refname:short)]=%(upstream:short)' \ | ||
--shell 'refs/heads/**' | ||
)" | ||
|
||
for b in "${!upstream[@]}"; do | ||
blen=${#b} ulen=${#upstream[$b]} | ||
(( bwidth = blen > bwidth ? blen : bwidth )) | ||
(( uwidth = ulen > uwidth ? ulen : uwidth )) | ||
IFS=/ read -r 'date[$b]' 'hash[$b]' 'message[$b]' < <( | ||
git log --no-walk=unsorted --format=%ct/%h/%s "$b" -- | ||
) | ||
hlen=${#hash[$b]} | ||
(( hwidth = hlen > hwidth ? hlen : hwidth )) | ||
done | ||
|
||
mapfile -t ordered < <( | ||
for b in "${!date[@]}"; do | ||
printf '%d\t%s\n' "${date[$b]}" "$b" | ||
done | sort -rn | cut -f2- | ||
) | ||
|
||
current=$(git symbolic-ref -q --short HEAD) | ||
|
||
for b in "${ordered[@]}"; do | ||
branch_color=$color_branch_local | ||
if [[ $b = "$current" ]]; then | ||
branch_color=$color_branch_current | ||
fi | ||
if [[ -t 1 ]]; then | ||
msg=${message[$b]:0:COLUMNS-bwidth-uwidth-hwidth-14} | ||
else | ||
msg=${message[$b]} | ||
fi | ||
printf '%(%Y-%m-%d)T %s%*s%s %s%*s%s %s%*s%s %s\n' \ | ||
"${date[$b]}" \ | ||
"$branch_color" "-$bwidth" "$b" "$reset" \ | ||
"$color_branch_upstream" "-$uwidth" "${upstream[$b]}" "$reset" \ | ||
"$color_diff_commit" "-$hwidth" "${hash[$b]}" "$reset" \ | ||
"$msg" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
.\" generated with Ronn/v0.7.3 | ||
.\" http://github.com/rtomayko/ronn/tree/0.7.3 | ||
. | ||
.TH "GIT\-BRV" "1" "January 2020" "" "Git Extras" | ||
. | ||
.SH "NAME" | ||
\fBgit\-brv\fR \- Show commit logs since some date | ||
. | ||
.SH "SYNOPSIS" | ||
\fBgit\-brv\fR [<date>] | ||
. | ||
.SH "DESCRIPTION" | ||
Pretty listing of branches sorted by the date of their last commit\. | ||
. | ||
.SH "EXAMPLES" | ||
Simply run \fBgit brv\fR | ||
. | ||
.IP "" 4 | ||
. | ||
.nf | ||
|
||
$ git brv | ||
2020\-01\-14 adds\-git\-brv fork/adds\-git\-brv 1ca0d76 Fixes #700: Adds git\-brv | ||
2020\-01\-08 master origin/master 265b03e Merge pull request #816 from spacewander/git\-sed\-pathspec | ||
. | ||
.fi | ||
. | ||
.IP "" 0 | ||
. | ||
.SH "AUTHOR" | ||
Written by Øsse <\fIhttps://github\.com/Osse\fR> | ||
. | ||
.SH "REPORTING BUGS" | ||
<\fIhttps://github\.com/tj/git\-extras/issues\fR> | ||
. | ||
.SH "SEE ALSO" | ||
<\fIhttps://github\.com/tj/git\-extras\fR> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
git-brv(1) -- Show commit logs since some date | ||
======================================================== | ||
|
||
## SYNOPSIS | ||
|
||
`git-brv` [<date>] | ||
|
||
## DESCRIPTION | ||
|
||
Pretty listing of branches sorted by the date of their last commit. | ||
|
||
## EXAMPLES | ||
|
||
Simply run `git brv` | ||
|
||
$ git brv | ||
2020-01-14 adds-git-brv fork/adds-git-brv 1ca0d76 Fixes #700: Adds git-brv | ||
2020-01-08 master origin/master 265b03e Merge pull request #816 from spacewander/git-sed-pathspec | ||
|
||
|
||
## AUTHOR | ||
|
||
Written by Øsse <<https://github.com/Osse>> | ||
|
||
## REPORTING BUGS | ||
|
||
<<https://github.com/tj/git-extras/issues>> | ||
|
||
## SEE ALSO | ||
|
||
<<https://github.com/tj/git-extras>> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters