Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A nice methodology to read an entire repo, each commit separately under a UNIX-like environment #148

Open
stefanos82 opened this issue Nov 13, 2024 · 0 comments

Comments

@stefanos82
Copy link

I have tried to read the entire code from first commit up until the last, but I would lose track most of the times as I was using git log --reverse -p; by the end I finished reading the current active commit in front of me, upon attempting the next day to come back to continue, I would get lost; it drove me insane!

So, I asked myself: what is the cleanest way to study any repo out there without losing track?

Seems like there's a "hack", so to speak, which is so convenient and elegant in my humble opinion.

With the kind assist of some folks from #git channel in Libera chat server (IRC), they came up with the following command:

git log --reverse -p | awk '/^commit/ { f = sprintf("%04d.patch", ++i) } 1 { print >> f }'

In other words, we take each commit and export it inside a .patch file that is also quite possible your favorite editor identifies this file format (I hope!).

image

Enjoy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant