18/2/2022

Git branch zoeken op basis van datum aktiviteit

Filed under: — cybrarian @ 12:21 pm

Binnen een branch kan je kijken met git log, maar als je een overzicht wil over alle branches…

Lijst van alle branches met laatste commit bericht:
git branch -v

Gesorteerd op datum (maar zonder die weer te geven)

git branch -v --sort=committerdate

Alle, inclusief remote:
git branch -v --sort=committerdate

git for-each-ref --sort='-committerdate:iso8601' --format='%(committerdate:relative)|%(refname:short)|%(committername)' refs/remotes/ | column -s '|' -t

2 months ago           origin/HEAD               matty
2 months ago           origin/master             matty
2 months ago           origin/test               matty
3 months ago           origin/feat-Day           matty
6 months ago           origin/integrate-lib      matty
3 years, 7 months ago  origin/feat-Fact       cybrarian

git for-each-ref --sort=-committerdate refs/heads/ --format='%(committerdate:short) %(authorname) %(refname:short)'

2022-02-11 cyb master
2022-02-11 cyb test
2022-02-09 cyb feat-DayAdd
2021-12-08 cyb fixMissingDayTypeDispl

git for-each-ref --sort=committerdate refs/heads/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))'

 fixMissingDayTypeDispl - a493cbe - FDayReq: fix missing daytype display - mat.ara (2 months ago)
* feat-DayAdd - dea7f5e - gitignore err - cyb (9 days ago)
  test - a94611e - merge test ie FMain.class - cyb (7 days ago)
  master - 33ac1e2 - fix Changes.txt  - cyb (7 days ago)

Met de datum ervoor:

git for-each-ref --sort=-committerdate refs/heads/ --format='%(authordate:short) %(color:red)%(objectname:short) %(color:yellow)%(refname:short)%(color:reset) (%(color:green)%(committerdate:relative)%(color:reset))'

Deze is ook mooi:

git branch -vv --color=always | while read; do echo -e $(git log -1 --format=%ci $(echo "_$REPLY" | awk '{print $2}' | perl -pe 's/\e\[?.*?[\@-~]//g') 2> /dev/null || git log -1 --format=%ci)" $REPLY"; done | sort -r | cut -d ' ' -f -1,4-

2022-02-11   master                 33ac1e2 [origin/master] fix Changes.txt for merge
2022-02-11   test                   a94611e [origin/test] fix merge test FMain.class
2022-02-09 * feat-DayAdd            dea7f5e [origin/feat-DayAdd] gitignore 
2021-12-08   fixMissingDayTypeDispl a493cbe FDayReq: fix missing daytype display

Of maak een alias

(Reeks Githandboek (nl)commando’s vbbranch, mergebranch zoeken/datumstashGitLab vbSourceForge vbgit en gambas)

Powered by WordPress