Skip to content

Instantly share code, notes, and snippets.

@tarunbehal
tarunbehal / git-branches-by-commit-date.sh
Created July 26, 2018 08:26 — forked from jasonrudolph/git-branches-by-commit-date.sh
List remote Git branches and the last commit date for each branch. Sort by most recent commit date.
# Credit http://stackoverflow.com/a/2514279
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r
var ageCompare = function(a,b) {
if (a["age"] < b["age"])
return -1;
if (a["age"] > b["age"])
return 1;
return 0;
}
var data = [{name:"a", age: 3}, {name:"b", age: 13}, {name:"c", age: 2}]
data.sort(ageCompare)