diff --git a/Commands.md b/Commands.md index 6fa0125..4cca302 100644 --- a/Commands.md +++ b/Commands.md @@ -153,6 +153,7 @@ $ git summary project : git-extras repo age : 10 months ago +branch : master last active : 3 weeks ago active on : 93 days commits : 163 @@ -226,11 +227,11 @@ This is how the `tebular` output style and `oneline` output style look like ```bash $ git summary --output-style tabular -# Repo | Age | Last active | Active on | Commits | Uncommitted -git-extras | 13 years | 7 hours ago | 807 days | 1703 | 3 +# Repo | Age | Last active | Active on | Commits | Uncommitted | Branch +git-extras | 13 years | 7 hours ago | 807 days | 1703 | 3 | master $ git summary --output-style oneline -git-extras / age: 13 years / last active: 7 hours ago / active on 807 days / commits: 1703 / uncommitted: 3 +git-extras / age: 13 years / last active: 7 hours ago / active on 807 days / commits: 1703 / uncommitted: 3 / branch: master ``` ## git effort diff --git a/bin/git-summary b/bin/git-summary index 4a650b2..6679c90 100755 --- a/bin/git-summary +++ b/bin/git-summary @@ -172,6 +172,10 @@ single_file() { done } +current_branch_name() { + git rev-parse --abbrev-ref HEAD +} + # # list the author for all file # @@ -211,14 +215,15 @@ print_summary_by_line() { print_summary() { if [ "$OUTPUT_STYLE" == "tabular" ]; then - tabular_headers="# Repo $SP Age $SP Last active $SP Active on $SP Commits $SP Uncommitted" - echo -e "$tabular_headers\n$project $SP $(repository_age) $SP $(last_active) $SP $(active_days "$commit") days $SP $(commit_count "$commit") $SP $(uncommitted_changes_count)" | column -t -s "$COLUMN_CMD_DELIMTER" + tabular_headers="# Repo $SP Age $SP Last active $SP Active on $SP Commits $SP Uncommitted $SP Branch" + echo -e "$tabular_headers\n$project $SP $(repository_age) $SP $(last_active) $SP $(active_days $commit) days $SP $(commit_count $commit) $SP $(uncommitted_changes_count) $SP $(current_branch_name)" | column -t -s "$COLUMN_CMD_DELIMTER" elif [ "$OUTPUT_STYLE" == "oneline" ]; then - echo "$project / age: $(repository_age) / last active: $(last_active) / active on $(active_days "$commit") days / commits: $(commit_count "$commit") / uncommitted: $(uncommitted_changes_count)" + echo "$project / age: $(repository_age) / last active: $(last_active) / active on $(active_days $commit) days / commits: $(commit_count $commit) / uncommitted: $(uncommitted_changes_count) / branch: $(current_branch_name)" else echo echo " project : $project" echo " repo age : $(repository_age)" + echo " branch: : $(current_branch_name)" echo " last active : $(last_active)" # shellcheck disable=SC2086 echo " active on : $(active_days $commit) days" diff --git a/man/git-summary.1 b/man/git-summary.1 index f0eae75..8fbacd6 100644 --- a/man/git-summary.1 +++ b/man/git-summary.1 @@ -69,7 +69,7 @@ This option can not be used together with \fB\-\-dedup\-by\-email\fR or \fB\-\-n \-\-output\-style