Git from the Bottom Up - Commits episode artwork

EPISODE · Aug 29, 2022 · 1H 37M

Git from the Bottom Up - Commits

from Coding Blocks · host Allen Underwood, Michael Outlaw, Joe Zack

We are committed to continuing our deep dive into Git from the Bottom Up by John Wiegley, while Allen puts too much thought into onions, Michael still doesn't understand proper nouns, and Joe is out hat shopping. The full show notes for this episode are available at https://www.codingblocks.net/episode192. News Thanks for the review Alex Woodhead! Want to help out the show? Leave us a review! Ludum Dare is a bi-annual game jam that's been running for over 20 years now. Jam #51 is coming up Sept 30th to October 3rd. (ldjam.com) We previously talked about Ludum Dare in episode 146. Commitment Issues Commits A commit can have one or more parents. Those commits can have one more parents. It's for this reason that commits can be treated like branches, because they know their entire lineage. You can examine top level referenced commits with the following command: git branch -v. A branch is just a named reference to a commit! A branch and a tag both name a commit, with the exception that a tag can have a description, similar to a commit. Branches are just names that point to a commit. Tags have descriptions and point to a commit. Knowing the above two points, you actually don't technically need branches or tags. You could do everything pointing to the commit hash id's if you were insane enough to do so. Here's a dangerous command: git reset --hard commitHash – This is dangerous. --hard says to erase all changes in the working tree, whether they were registered for a check-in or not and reset HEAD to point to the commitHash. Here's a safer command: git checkout commitHash – This is a safer option, because files changed in the working tree are preserved. However, adding the -f parameter acts similar as the previous command, except that it doesn't change the branch's HEAD, and instead only changes the working tree. Some simple concepts to grasp: If a commit has multiple parents, it's a merge commit. If a commit has multiple children, it represents the ancestor of a branch. Simply put, Git is a collection of commits, each of which holds a tree which reference other trees and blobs, which store data. All other things in Git are named concepts but they all boil down to the above statement. A commit by any other name The key to knowing Git is to truly understand commits. Learning to name your commits is the way to mastering Git. branchname – The name of a branch is an alias to the most recent commit on that branch. tagname – Similar to the branch name in that the name points to a specific commit but the difference is a tag can never change the commit id it points to. HEAD – The currently checked out commit. Checking out a specific commit takes you out of a "branch" and you are then in a "detached HEAD" state. The 40 character hash id – A commit can always be referenced by the full SHA1 hash. You can refer to a commit by a shorter version of the hash id, enough characters to make it unique, usually 6 or 7 characters is enough. name^ – Using the caret tells Git to go to the parent of the provided commit. If a commit has more than one parent, the first one is chosen. name^^ – Carets can be stacked, so doing two carets will give the parent of the parent of the provided commit. name^2 – If a commit has multiple parents, you can choose which one to retrieve by using the caret followed by the number of the parent to retrieve. This is useful for things like merge commits. name~10 – Same thing as using the commit plus 10 carets. It refers to the named commit's 10th generation ancestor. name:path – Used to reference a specific file in the commit's content tree, excellent when you need to do things like compare file diffs in a merge, like: git diff HEAD^1:somefile HEAD^2:somefile. name^{tree} – Reference the tree held by a commit rather than the commit itself. name1..name2 – Get a range of commits reachable from name2 all the way back to, but not including, name1. Omitting name1 or name2 will substitute HEAD in the place. name1…name2 – For commands like log, gets the unique commits that are referenced by name1 or name2. For commands like diff, the range is is between name2 and the common ancestor of name1 and name2. main.. – Equivalent to main..HEAD and useful when comparing changes made in the current branch to the branch named main. ..main – Equivalent to HEAD..main and useful for comparing changes since the last rebase or merge with the branch main, after fetching it. -since="2 weeks ago" – All commits from a certain relative date. –until="1 week ago" – All commits before a certain relative date. –grep=pattern – All commits where the message meets a certain regex pattern. –committer=pattern — Find all the commits where the committer matches a regex pattern. –author=pattern – All commits whose author matches the pattern. So how's that different than the committer? "The author of a commit is the one who created the changes it represents. For local development this is always the same as the committer, but when patches are being sent by e-mail, the author and the committer usually differ." –no-merges – Only return commits with a single parent, i.e. ignore all merge commits. Resources We Like Git from the Bottom Up by John Wiegley (jwiegley.github.io) The beauty of commits (jwiegley.github.io) A commit by any other name… (jwiegley.github.io) TotW from the past: Not sure where the history of your branch started from and want an easy button? Check out Allen's TotW from episode 182. Need to search the entire history of the repo for some content (text, code, etc.) that's not part of the current branch? Content, not a commit comment, not a commit ID, but content. Check out Michael's TotW from episode 31. Nobody Likes Onions, a podcast that has been making audiences laugh at the absurd, the obvious, and the wrong, for a very long time. (NobodyLikesOnions.com) Tip of the Week Supabase is an open-source alternative to Google's Firebase that is based on PostgreSQL. The docs are great and it's really easy to work through the "Getting Started" guide to set up a new project in the top framework of your choice, complete with a (for now) free, hosted PostgreSQL database on Heroku, with authentication (email/password or a myriad of providers). RBAC is controlled via database policies and everything can be administered through the portal. You can query the database with a simple DSL. Joe was able to work through a small project and get it hosted on Netlify (with SSL!) all for free in under 2 hours. (supabase.com) Obsidian is a really cool way to associate markdown data with your files. (Thanks Simon Barker!) (obsidian.md) Ever use a "mind map" tool? MindNode is a great, free, mind mapping tool to help you organize your thoughts (Thanks Sean Martz!) (mindnode.com) Ink Drop is a cool way to organize and search your markdown files (inkdrop.app) (Thanks Lars!) Tired of git log knocking the rest of your content off screen? You can configure Git to run a custom "core.pager" command with the args you prefer: (serebrov.github.io) To configure just Git: git config --global --replace-all core.pager "less -iXFR" Or, to modify how less prints to the screen and commands that rely on it, including Git, edit your ~/.bashrc or ~/.zshrc, etc. and add export LESS=-iXFR to the file.

Episode metadata supplied by the publisher feed · Published Aug 29, 2022

NOW PLAYING

Git from the Bottom Up - Commits

0:00 1:37:08

No transcript for this episode yet

We transcribe on demand. Request one and we'll notify you when it's ready — usually under 10 minutes.

API Intersection Stoplight Building a successful API requires more than just coding. It starts with collaborative design, focuses on creating a great developer experience, and ends with getting your company on board, maintaining consistency, and maximizing your API’s profitability.In the API Intersection, you’ll learn from experienced API practitioners who transformed their organizations, and get tangible advice to build quality APIs with collaborative API-first design.Jason Harmon brings over a decade of industry-recognized REST API experience to discuss topics around API design, governance, identity/auth versioning, and more.They’ll answer listener questions, and discuss best practices on API design (definition, modeling, grammar), Governance (multi-team design, reviewing new API’s), Platform Transformation (culture, internal education, versioning) and more.They’ll also chat with experienced API practitioners from a wide array of industries to draw out practical takeaways and insights you can use.H Unshamed & Unchained: Carving Space For Self-Healing & Habit Transformation Danny Poelman Welcome to "Unshamed & Unchained: Carving Space For Self-Healing & Habit Transformation", the podcast where we break the chains of shame and societal expectations to create a safe space for self-healing, habit transformation, and personal growth. Hosted by a seasoned life coach, Danny Poelman DDS, with years of hands-on experience, this podcast is your guide to reclaiming your voice, embracing your story, and living life on your terms.In each episode, we dive deep into the topics that matter most to you—whether it's:-breaking free from unwanted habits like pornography-excessive people-pleasing-healing from past trauma-recovering from narcissistic abuse or religious/relational trauma-anxiety/depression-money mindset blocks-overcoming limiting beliefsWe’re not afraid to talk about the things that are often considered taboo, because we believe that through honest, unfiltered conversations, real transformation happens.You’ll hear real Khanyisa Keke TV Khanyisa Keke On Khanyisa Keke TV, developers can learn and improve their Android for Kotlin Development skills. On this podcast, programmers can learn Android for Kotlin coding from scratch, improve their existing programming skills, get tips, be kept up to date with all the latest happenings and get access to free resources. Powered by Firstory Hosting The Triathlon Mental Performance Podcast Neil Edge This podcast is for you if you are a Triathlete that is interested in learning about tools and strategies to overcome challenges and to utilize the power of your mind to race faster.I'm an experienced Triathlon Mental Performance Coach working with both Age Groupers and Pros.Episodes will cover the following and more.How to improve your mental toughnessRemoving the possibility of panic attacks in open water Removing the fear of fast descents on your bike -Removing mental blocks to improve your race times Completely remove performance anxiety (you don't have to just cope with it)4 weeks to race day - Strategies to  arrive at your a-race feeling calm and confident, with race day mental strategiesI will also talk about specific tools that you can use to ensure that you race faster.<b

Frequently Asked Questions

How long is this episode of Coding Blocks?

This episode is 1 hour and 37 minutes long.

When was this Coding Blocks episode published?

This episode was published on August 29, 2022.

What is this episode about?

We are committed to continuing our deep dive into Git from the Bottom Up by John Wiegley, while Allen puts too much thought into onions, Michael still doesn't understand proper nouns, and Joe is out hat shopping. The full show notes for this episode...

Can I download this Coding Blocks episode?

Yes, you can download this episode by clicking the download button on the episode player, or subscribe to the podcast in your preferred podcast app for automatic downloads.
URL copied to clipboard!