/Git

Git Notes: Git's Coolest, Most Unloved­ Feature

- Tyler Cipriani tl;dr: "A common use of git notes is tacking metadata onto commits. Once a commit cements itself in git’s history - that’s it. It’s impossible to amend a commit message buried deep in a repo’s log. But git notes enable you to amend new information about old commits in a special namespace. And they’re capable of so much more. Notes stow metadata about anything tracked by git - any object: commits, blobs, and trees. All without futzing with the object itself."

featured in #464


Confusing Git Terminology

- Julia Evans tl;dr: "One of my biggest problems is that after almost 15 years of using git, I’ve become very used to git’s idiosyncrasies and it’s easy for me to forget what’s confusing about it." Julia asked folks "what git jargon do you find confusing? thinking of writing a blog post that explains some of git’s weirder terminology: “detached HEAD state”, “fast-forward”, “index/staging area/staged”, “ahead of ‘origin/main’ by 1 commit”, etc."

featured in #463


My Muscle-Memory Git Toolbox

- Arthur O’Dwyer tl;dr: "This post focuses on my basic muscle-memory git commands. There are at least two other major Git subtopics this post doesn’t mention at all: “branching discipline” (what is a release branch? what’s the difference between rebase and merge?) and “hygiene” (how big should a commit be? what does a good commit message look like?). That is — as usual for this blog — we’re talking tactics, not strategy."

featured in #462


Some Miscellaneous Git Facts

- Julia Evans tl;dr: “None of these things feel super surprising in retrospect, but I hadn’t thought about them clearly before. The facts are: (1) The “index”, “staging area” and “–cached” are all the same thing. (2) The stash is a bunch of commits. (3) Not all references are branches or tags. (4) Merge commits aren’t empty.” Julia discusses each in detail.

featured in #459


Organizing Multiple Git Identities

- Garrit Franke tl;dr: “One awesome feature of the .gitconfig file is that you can conditionally include other config files, and this is what does the trick.” Garrit shows us what this looks like and how he manages multiple Git identities in a streamlined way.

featured in #457


Git Commit And Commit Message Best Practices

- Justin Joyce tl;dr: Justin shares best practices for git commits and commit messages. Commit best practices include: (1) Commit often: Save work at incremental steps. (2) Keep commits self-contained: Ensure each commit represents a distinct piece of work. (3) Keep commits small: Commit frequently to maintain smaller changes. For commit messages: (1) Keep messages short: Aim for a one-liner, ideally under 70 characters. (2) Be descriptive yet concise: Summarize the commit's essence succinctly. (3) Be specific: Clearly indicate the nature and location of the change.The author emphasizes clarity and specificity over strict adherence to tense or voice in messages.

featured in #456


In A Git Repository, Where Do Your Files Live?

- Julia Evans tl;dr: Julia explores the inner workings of git, specifically how it stores files in the .git/objects directory. Through Python programs, Julia investigates the location of specific files and their older versions discovering "content addressed storage," where the filename is the hash of the file's content. The article also demystifies the encoding process, showing that files are zlib compressed, and emphasizes that git stores complete files, not just the differences.

featured in #449


Git Log Customization

- Justin Joyce tl;dr: Justin explains how to customize the git log command to make its output more concise and informative. The article introduces the --oneline option for a condensed view. However, this omits details like the author, date, and associated branch. To visualize branches, the --graph option is introduced. The article focuses on custom log formatting using the --pretty option. Justin shares a personal git log format, which includes the commit hash, message, relative date, and author's name, each with distinct color coding.

featured in #442


Git Tips And Tricks

- Justin Joyce tl;dr: Topics covered include Git aliases for simplifying common commands, using the .gitconfig file for default settings, the --stat flag for an overview of changes, Git stash for managing changes without committing, rebasing techniques, amending commits, cherry-picking commits from one branch to another, and resetting commits. The author shares personal insights and examples, aiming to make daily Git usage more efficient.

featured in #441


ugit: DIY Git In Python

tl;dr: ugit is a small implementation of a Git-like version control system. “It's top goal is simplicity and educational value. ugit is implemented in small incremental steps, with each step explained in detail. Hopefully you will be able to read the small steps and slowly build a complete picture of the internals.”

featured in #414