# Am I in the right branch? Did I push my latest commit?
git log
# Who has worked on this project/folder?
git log -- . # Then search "author" with the pager
# What have I worked on recently? Or, What branches have I authored?
git log --branches --no-walk --author=Guilherme
# When did we last touch this file? When was it added
# cwd is /Users/guilherme.freitas/ml/projects/pricing/connections/cputils/cputils
git log --name-status -- fetch.py
# I remember logging when this code was working with a specific upstream data source (MVIPRenewals flow)... when was that?
# I'll search messages for the word "works" for the relevant folder
# cwd is ml/projects/churn/mvip
git log --grep works --author=Guilherme -- .
# What's the history of changes in this file? Did it ever have this string?
git log --patch -- fetch.py # then search for the string manually
# Did I ever commit the docs for the revenue model for C+ Pricing? I know it had the word "concave"
# cwd is /Users/guilherme.freitas/ml/
git log --author=Guilherme --patch -G concave --all
# Where is Maanit's MVIPRenewal's flow defined? It's not in master, and I need to run it because of pandas version issues
git log -G MVIPRenewals --all --author=Maanit # you could use --patch to look at the code to confirm
git branch -a --contains d1cb2af0c6c3ce56cccb0e92a4b1366cabd2d91b # to find the actual branch if you want the latest code with that
# What's the history of this function?
# cwd is /Users/guilherme.freitas/ml/projects/pricing/connections/cputils/cputils
git log -L ':get_market_tags:fetch.py'
# What's the history of this query (note we just define a code block by regex to pick the query)?
# cwd is ml/projects/pricing/connections/cputils/cputils/queries
git log -L '/REFERRAL_RPL_FROM_ANALYTICS_QUERY = """/,/"""/:referral.py'
# For performance review: what have I worked on in the last year?
# This is not a perfect answer, but it helps.
git log --author=Guilherme --since='2022-05-01' master
# When was the latest time someone used shap in our codebase?
git log -G 'import shap' --oneline --name-status --pretty=reference
Last active
July 18, 2024 20:27
-
-
Save gpfreitas/2c160eed187cbef0166f17034301590a to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also rebasing: let's say you want to move your current branch from commit
x
(inclusive) toHEAD
onto a new base. Then you runWhere
parent_of_x
is, you guessed it, the parent commit tox
.So for example, I had the following git log:
And I wanted to obtain this git log:
To that end, I ran