Skip to content

Instantly share code, notes, and snippets.

@MichaelDimmitt
Last active July 23, 2024 16:11
Show Gist options
  • Save MichaelDimmitt/6516937f2aa47f68a20f3efd206e0d8d to your computer and use it in GitHub Desktop.
Save MichaelDimmitt/6516937f2aa47f68a20f3efd206e0d8d to your computer and use it in GitHub Desktop.
A fun way to read through a javascript project.

A fun way to read through a javascript project.

Summary:

Your package. json file will tell the story of the dependencies in your project.
I wanted to find out when a certain dependency changed which caused a project structure change.

To achieve I setup a:

  1. A terminal on the left running the log commands on the package.json file.
  2. A terminal on the right showing a diff of only the package.json file via git show.

Left terminal commands:

git log --reverse -- package.json
git log --reverse -- package.json | grep commit
git log --reverse -- package.json | grep <sometext> -A 3 -B 4

Right terminal commands:

function gsp() { git show "$@" -- package.json; }; # I added to bashrc and sourced. But can just be added inline.
gsp <sha1>
gsp <sha2>
gsp <sha3>

After that research I thought it would be fun to look at all merges that say Pull request in reverse order.

git log --reverse --merges
git log --reverse --merges | grep Pull
# Note: Some tools like bitbucket auto generate text in their pr's that state "Pull request" which is why I used grep Pull
Screenshot 2024-07-23 at 11 58 34 AM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment