/Git

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


Writing Tips for Improving Your Pull Requests

- Jeff Mueller tl;dr: “I’m going to show you how to purposely write less by using the techniques below.” Tips are: (1) Make it scannable. (2) Speak plainly. (3) Avoid adverbs. (4) Simplify your sentences. (5) Avoid a passive voice. Jeff adds examples to each.

featured in #404


5 Tips To Creating A (Good) Pull Request

- Danijela Vrzan tl;dr: (1) Keep it short. (2) Add more information i.e. the what, why and screenshots. (3) Leave in-line code comments. (4) Assign people or groups as reviewers. (5) Let your colleagues know your PR is ready for review.

featured in #390


Git Commands You Probably Do Not Need

- Martin Myrseth tl;dr: Martin discusses: (1) The empty commit. (2) Pushing locally. (3) Commit ranking. (4) Cat file. (5) Orphan commits. (6) Filter branch. (7) Octopus merge. (8) Rounding off.

featured in #383


The Perfect Commit

- Simon Willison tl;dr: The perfect commit is a single commit that contains the following: (1) A single, focused change. (2) Tests that demonstrate the implementation works. (3) Updated documentation reflecting the change. (4) A link to an issue thread providing further context.

featured in #365


Scaling Git’s Garbage Collection

- Taylor Blau tl;dr: The process for permanently removing unreachable objects from a repository’s history has a history of causing problems within GitHub, especially in busy repositories or ones with lots of objects. In this post, we’ll talk about what those problems were, why we had them, the tools we built to address them, and some interesting ways we’ve built on top of them. 

featured in #354