# 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.
Also rebasing: let's say you want to move your current branch from commit x
(inclusive) to HEAD
onto a new base. Then you run
git rebase -i --onto new_base parent_of_x
Where parent_of_x
is, you guessed it, the parent commit to x
.
So for example, I had the following git log:
* 0fc7b523b - (gui/fader_model_dev_to_rebase) Fix: add invoke to create env script [Guilherme Freitas] (23 minutes ago)
* 54f413c8f - Incr. mem of join step to 24GB, add data test task [Guilherme Freitas] (24 minutes ago)
* 41dbf3733 - Better test to look into failure of flow [Guilherme Freitas] (4 hours ago)
* 22290e523 - Minor fix (Import error) from prev commit [Guilherme Freitas] (22 hours ago)
* 042ce3a44 - Address Evan's comment from an upstream PR about... [Guilherme Freitas] (22 hours ago)
* dd5530d0f - Better comments on lib_pul.py [Guilherme Freitas] (23 hours ago)
* 5eb56d471 - Addressing earlier/upstream PR comments [Guilherme Freitas] (23 hours ago)
* fe464ef23 - Cleaner reporting on the pull flow. [Guilherme Freitas] (24 hours ago)
* 79d023009 - make sure batch is imported from metaflow [Guilherme Freitas] (27 hours ago)
* d54c44a63 - Update metaflow to 2.12.8 and netflix extensions [Guilherme Freitas] (27 hours ago)
* 23abb40c4 - Reintroduce the @batch decorators [Guilherme Freitas] (27 hours ago)
* de8240df3 - Minor rename [Guilherme Freitas] (27 hours ago)
* 66cdece5d - Minor docstring improvements. [Guilherme Freitas] (2 days ago)
* b2c4d5486 - Still trying to fix prev^3 commit [Guilherme Freitas] (2 days ago)
* 3acb37b0a - Minor fix to prev prev commit [Guilherme Freitas] (2 days ago)
* a9497096d - Minor fix to prev commit [Guilherme Freitas] (2 days ago)
* ffd426299 - Trying to pass df to join instead of delayed [Guilherme Freitas] (2 days ago)
* dae6fcb5e - Try to run delayed tasks in the flow. [Guilherme Freitas] (2 days ago)
* 5756ed56a - Pull run id 248787 based off of this. [Guilherme Freitas] (2 days ago)
* 5b5ddff99 - Minor [Guilherme Freitas] (2 days ago)
* 63c35ad5f - Minor fix [Guilherme Freitas] (2 days ago)
* e60809f44 - utils and pull tests pass [Guilherme Freitas] (2 days ago)
* 63478fe91 - Fix the acv make_daily_live... func [Guilherme Freitas] (3 days ago)
* 3eefdb2c2 - Update test_utils validate_config_dates [Guilherme Freitas] (3 days ago)
* 94dfc532d - Now actually fixing the ACV issue. [Guilherme Freitas] (3 days ago)
* d9e5496d0 - Fix min/max/latest etc. ACV query [Guilherme Freitas] (3 days ago)
* f73ab5c2a - More generic and documented tasks.py [Guilherme Freitas] (3 days ago)
* 9a60e03e2 - (HEAD -> gui/fader_model_dev, origin/gui/fader_model_dev) Allow fixture sync to delete fixtures in dest. [Guilherme Freitas] (16 hours ago)
* d146cf0d1 - Minor fix (Import error) from prev commit [Guilherme Freitas] (16 hours ago)
* 2a4ca69d5 - Address Evan's comment from an upstream PR about... [Guilherme Freitas] (16 hours ago)
* 42bbad6b4 - Better comments on lib_pul.py [Guilherme Freitas] (16 hours ago)
* 9475947a8 - Addressing earlier/upstream PR comments [Guilherme Freitas] (16 hours ago)
And I wanted to obtain this git log:
* a15a9f92a - (HEAD -> gui/fader_model_dev_to_rebase) Fix: add invoke to create env script [Guilherme Freitas] (5 minutes ago)
* 8a79e511a - Incr. mem of join step to 24GB, add data test task [Guilherme Freitas] (6 minutes ago)
* 0e9b920db - Better test to look into failure of flow [Guilherme Freitas] (6 minutes ago)
* 9a60e03e2 - (origin/gui/fader_model_dev, gui/fader_model_dev) Allow fixture sync to delete fixtures in dest. [Guilherme Freitas] (16 hours ago)
* d146cf0d1 - Minor fix (Import error) from prev commit [Guilherme Freitas] (16 hours ago)
* 2a4ca69d5 - Address Evan's comment from an upstream PR about... [Guilherme Freitas] (16 hours ago)
* 42bbad6b4 - Better comments on lib_pul.py [Guilherme Freitas] (16 hours ago)
* 9475947a8 - Addressing earlier/upstream PR comments [Guilherme Freitas] (16 hours ago)
To that end, I ran
git rebase -i --onto gui/fader_model_dev 22290e523
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Not git log related, but I need to put this somewhere:
Had to develop
your_branch
off ofanother
dev branch (not master)? Now need to merge just your work fromyour_branch
intomaster
without theanother
commits?One option would be to
revert
all the commits from theanother
branch. I had a hard time doing that, so eventually gave up.But
rebase
worked like a charm:In fact this is in the
git rebase
man/help page (search for--onto
):My use-case was: I needed to run a flow that was in
maanit/mvip_renewals
to do my work onmvip_churn_request_by_mark_maanit_20230710
. But I didn't need code from Maanit's branch, just the results of the flow, so at merge time, I rangit rebase -i --onto master maanit/mvip_renewals mvip_churn_request_by_mark_maanit_20230710
to get just the commits I wrote.