Skip to content

Instantly share code, notes, and snippets.

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 jmccay-work/f449888d18ce9bd802f53ade1fcef0c3 to your computer and use it in GitHub Desktop.
Save jmccay-work/f449888d18ce9bd802f53ade1fcef0c3 to your computer and use it in GitHub Desktop.
List remote Git branches and the last commit date for each branch. Sort by oldest commit date.
# Credit https://gist.github.com/jasonrudolph/1810768
# Credit http://stackoverflow.com/a/2514279
for branch in `git branch -r | grep -v HEAD`;
do printf "%-40s\\t%20s\\n" $branch "`git show --format="%ci %cr" $branch | head -n 1`";
done | sort -k 2
# Example output from the jfx repository at https://github.com/openjdk/jfx.git
origin/jfx14 2020-07-22 14:54:28 +0000 3 years, 5 months ago
origin/jfx15 2020-10-23 12:17:30 +0000 3 years, 2 months ago
origin/jfx16 2021-03-04 11:58:59 +0000 2 years, 10 months ago
origin/jfx17 2021-09-15 16:17:02 +0000 2 years, 3 months ago
origin/jfx18 2022-07-19 19:33:16 +0000 1 year, 5 months ago
origin/jfx19 2023-01-20 13:36:46 +0000 11 months ago
origin/jfx20 2023-01-21 21:50:41 +0000 11 months ago
origin/master 2023-01-24 15:10:44 +0000 11 months ago
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment