Skip to content

Instantly share code, notes, and snippets.

@nguyenbathanh
Forked from mroderick/find-old-branches.sh
Created March 5, 2020 00:58
Show Gist options
  • Select an option

  • Save nguyenbathanh/94b29c195f3bbf4d9aacb3d25679c817 to your computer and use it in GitHub Desktop.

Select an option

Save nguyenbathanh/94b29c195f3bbf4d9aacb3d25679c817 to your computer and use it in GitHub Desktop.

Revisions

  1. @mroderick mroderick revised this gist Mar 27, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions find-old-branches.sh
    Original file line number Diff line number Diff line change
    @@ -7,8 +7,8 @@
    # In the meantime, I am using this

    echo "Merged branches"
    for branch in `git branch -r --merged | grep -v HEAD`;do echo -e `git show --format="%ci, %cr, %an, %ae, " $branch | head -n 1` \\t$branch; done | sort -r
    for branch in `git branch -r --merged | grep -v HEAD`;do echo -e `git log --no-merges -n 1 --format="%ci, %cr, %an, %ae, " $branch | head -n 1` \\t$branch; done | sort -r

    echo ""
    echo "Not merged branches"
    for branch in `git branch -r --no-merged | grep -v HEAD`;do echo -e `git show --format="%ci, %cr, %an, %ae, " $branch | head -n 1` \\t$branch; done | sort -r
    for branch in `git branch -r --no-merged | grep -v HEAD`;do echo -e `git log --no-merges -n 1 --format="%ci, %cr, %an, %ae, " $branch | head -n 1` \\t$branch; done | sort -r
  2. @mroderick mroderick created this gist Mar 6, 2015.
    14 changes: 14 additions & 0 deletions find-old-branches.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    #!/bin/bash

    # This is a very naive script, it doesn't do grouping and returns all branches
    # I only really care about branches that have not seen commits in two months
    #
    # I am hoping to find some time to write a tool that can output these reports for me
    # In the meantime, I am using this

    echo "Merged branches"
    for branch in `git branch -r --merged | grep -v HEAD`;do echo -e `git show --format="%ci, %cr, %an, %ae, " $branch | head -n 1` \\t$branch; done | sort -r

    echo ""
    echo "Not merged branches"
    for branch in `git branch -r --no-merged | grep -v HEAD`;do echo -e `git show --format="%ci, %cr, %an, %ae, " $branch | head -n 1` \\t$branch; done | sort -r