Git/log: Difference between revisions
add CSV section |
Add shortlog |
||
| Line 1: | Line 1: | ||
[[File:Git log color.png|thumb]] | [[File:Git log color.png|thumb]] | ||
We use <code>git log</code> for creating [[RELEASE NOTES]] | We use <code>git log</code> for creating [[RELEASE NOTES]] (Refer to the script there.) | ||
| Line 298: | Line 298: | ||
<code>git log --since "2 years ago" --pretty=format:"%s" --no-merges | awk '{print tolower($1)}' | sort | uniq -c | sort -nr | head -20</code> | <code>git log --since "2 years ago" --pretty=format:"%s" --no-merges | awk '{print tolower($1)}' | sort | uniq -c | sort -nr | head -20</code> | ||
== Comparing branches and foreign (upstream) repos == | |||
As you may know, the triple dot notation means to find the common ancestor. Using that with <code>shortlog</code> allows to quickly find the differences between branches or even 'upstream' repos - especially in conjunction with <code>--cherry-pick --right-only</code>. | |||
This is the command you want if you've ever wondered how GitHub shows you that your fork is '''X commits ahead, Y commits behind''<nowiki/>' repo ACME and you want to get a quick overview of the situation. | |||
<code>git shortlog nasa/main...origin/REL1_43 --cherry-pick --right-only</code> | |||
[[Category:Best Practices]] | [[Category:Best Practices]] | ||
[[Category:Release Engineering]] | [[Category:Release Engineering]] | ||
[[Category:GitOps]] | [[Category:GitOps]] | ||
[[Category:DevOps]] | [[Category:DevOps]] | ||