Tekin Limited is registered in England and Wales with Company numberĠ8423819 and VAT number GB 157904388. Zero spam, and you can unsubscribe whenever you like with a single click.Įmail GitHub GitHub icon An icon of the GitHub logomark Mastodon Mastodon icon An icon of the Mastodon logomark Twitter Twitter icon An icon of the Twitter logomark You'll get an email whenever I have a fresh insight or tip to share. Want more juicy Git tips like this straight to your inbox? To learn more about the how and why of putting together more useful histories, check out A Branch in Time (a talk about revision histories). If the history hasn’t been constructed with atomic commits that have useful commit messages, searching it will likely be a frustrating and unhelpful experience. Of course searching a codebase’s history will only be fruitful if the history itself is helpful. Search commit messages using git log -grep.Search with a regular expression using git log -G.Scope search to specific folders or files by including a path.Include -reverse to see the commit that introduced the code listed first.Include -p to see the diff as well as the commit messages.Find the entire history of a snippet of code with git log -S.Next time some code has you puzzled and you want to understand more about it, look beyond git blame and dig deeper into the history using the pickaxe and friends: It lets you search for all commits that contain a given string: If git blame is entry-level history search, git log -S (also known as “the pickaxe”) is how you take things to the next level. Find all commits containing a particular piece code Let’s take a closer look at some of the tools at our disposal. Thankfully Git has some pretty powerful search tools built right in. Wouldn’t it be better to view things in 3D!? A more powerful way to trace the history of WTF code If you only use git blame you’re limiting yourself to a one-dimensional perspective of the code you’re trying to understand. If you are coding on Visual Studio Code like me, you should activate git blame by following these steps : - Open Visual Studio Code. The code you are interested in may also appear in other files, but to get the relevant commits on those you’ll need to run blame several times.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |