Posts

Showing posts from July, 2020

List remote Git branches With the last commit date, commit user, Sort by most recent commit date

Find the last committed Date and Time in the current local branch : $ git log -1 --format=%cd >>>Sun Jun 14 05:03:27 2020 +0530 Find the last committed dates in current checkout local branches : ASC $ for k in `git branch | perl -pe s/^..//`; do echo -e `git show --pretty=format:"%Cgreen%ci %Cblue%cr%Creset" $k -- | head -n 1`\\t$k; done | sort -r >>>2020-06-14 05:03:27 +0530 3 weeks ago branch2 >>>2020-05-03 10:10:41 +0000 9 weeks ago master DESC $ for k in `git branch | sed s/^..//`; do echo -e `git log -1 --pretty=format:"%Cgreen%ci %Cblue%cr%Creset" $k --`\\t"$k";done | sort >>>2020-05-03 10:10:41 +0000 9 weeks ago master >>>2020-06-14 05:03:27 +0530 3 weeks ago branch2 Using git branch -r, you can similarly show remote branches : $ for k in `git branch -r | perl -pe 's/^..(.*?)( ->.*)?$/\1/'`; do echo -e `git show --pretty=format:"%Cgreen%ci %Cblue%cr%Creset" $k -- | head -n 1`\\...