Git Icon

Git

Git is the most widely used version control system.
97 Stories
All Topics

Daniel Janus blog.danieljanus.pl

Things I wish Git had: Commit groups

Commit groups sounds interesting to me. Anyone reading this familiar with Git innards? Is this doable?

You know the “group” facility of vector graphics programs? You draw a couple of shapes, you group them together, and then you can apply transformations to the entire group at once, operating on it as if it were an atomic thing. But when need arises, you can “ungroup” it and look deeper.

I’d love to see that same idea applied to Git commits. In Git, a commit group might just be a named and annotated range of commits: feature-a might be the same as 5d64b71..3db02d3. Every Git command that currently accepts commit ranges could accept group names. I envision groups to have descriptions, so that git log, git blame, etc could take –grouped or –ungrouped options and act appropriately.

Git blog.waleedkhan.name

Git undo: we can do better

Sad but true: Git is simply too hard. One thing driving said truth is that undoing things often requires jumping through obscure hoops. Here’s what Waleed Khan has to say on the matter:

Well, it’s not that it’s too easy to lose your data — but rather, that it’s too difficult to recover it. For each operation you want to recover from, there’s a different “magic” incantation to undo it. All the data is still there in principle, but it’s not accessible to many in practice.

Here’s my theory: novice and intermediate users would significantly improve their understanding and efficacy with Git if they weren’t afraid of making mistakes.

To address this, Waleed created git undo as part of his git-branchless suite of tools.

Lj Miranda ljvmiranda921.github.io

What can "Avengers: Endgame" teach us about Git?

LJ Miranda:

When I first saw “Avengers: Endgame” in theaters, I noticed that their time travel rule is quite similar to the Git branching model. Referred to as the time heist, our heroes travelled through time to recover the stones…

I had to truncate that pull quote to avoid Avengers spoilers. If you’ve seen the movie (or don’t care about getting spoiled) there’s some good Git knowledge to be gained from this analogy.

Git github.com

A simple and efficient way to access various stats in a Git repo

Any git repository may contain tons of information about commits, contributors, and files. Extracting this information is not always trivial, mostly because there are a gadzillion options to a gadzillion git commands – I don’t think there is a single person alive who knows them all. Probably not even Linus Torvalds himself :).

A simple and efficient way to access various stats in a Git repo

Opensource.com Icon Opensource.com

Reasons I use the git cherry-pick command

Here is an example to help you understand the importance of cherry-picking. Suppose you have made several commits in a branch, but you realize it’s the wrong branch! What do you do now? Either you repeat all your changes in the correct branch and make a fresh commit, or you merge the branch into the correct branch. Wait, the former is too tedious, and you may not want to do the latter. So, is there a way? Yes, Git’s got you covered.

I’m a pretty big fan of cherry-pick, too. I don’t use it often, but every time I do… 👨‍🍳💋

Databases github.com

Dolt – it's Git for data

Imagine a world where Git and MySQL got together and had a baby. They would name that baby, Dolt.

Dolt is a SQL database that you can fork, clone, branch, merge, push and pull just like a git repository. Connect to Dolt just like any MySQL database to run queries or update the data using SQL commands. Use the command line interface to import CSV files, commit your changes, push them to a remote, or merge your teammate’s changes.

All the commands you know for Git work exactly the same for Dolt. Git versions files, Dolt versions tables.

The authors also created DoltHub where you can host and share your Dolt databases.

Git github.com

Communicate important updates to your team via git commit messages

Sometimes you need to communicate changes to other developers on your project. In a small team, a Slack message works okay, but in larger teams and distributed organizations (such as open source projects), reaching everyone can be a pain.

Logging this because it’s an interesting idea, but I’m not sure if it’s a good idea. Is this a good idea?

Communicate important updates to your team via git commit messages

Jonas Lundberg iamjonas.me

We need to talk about your commit messges

Jonas Lundberg:

We all do it. Up to many times a day and yet it’s rare that I meet someone that has given it a second thought. No, it’s not secretly snacking chocolate from your top office drawer.

It’s how you write and structure your commits. Possibly while snacking chocolate.

What follows is a piece marrying atomic commits (as in small commits with one focus) with Donald Knuth’s literate programming. It ends with some research on whether or not this practice commonplace on the 100 most popular GitHub repos.

Patrick DeVivo try.askgit.com

Try AskGit SQL in your browser

Remember Patrick DeVivo’s super cool AskGit project where you can query your git repo’s history with SQL? Well, now you can kick the tires without installing a thing by using AskGit’s new web interface!

Here’s an example query where we learn that I do most of my coding (or committing, at least) on Mondays and Tuesdays while Adam and Gerhard lean towards Friday.

Patrick DeVivo augmentable.medium.com

Identifying code churn with AskGit SQL

In which I detail A SQL query that helps you identify files in a codebase that have “churned” in the past year. In other words, list the files that have been changed by the most number of commits in the last year.

SELECT file,
       COUNT(*)
FROM   stats
       JOIN commits
         ON stats.commit_id = commits.id
WHERE  commits.author_when > DATE('now', '-12 month')
       AND commits.parent_count < 2 -- ignore merge commits
GROUP  BY file
ORDER  BY COUNT(*) DESC
LIMIT  50

Git daniel.haxx.se

This is how I git

Daniel Stenberg:

Every now and then I get questions on how to work with git in a smooth way when developing, bug-fixing or extending curl – or how I do it. After all, I work on open source full time which means I have very frequent interactions with git (and GitHub). Simply put, I work with git all day long. Ordinary days, I issue git commands several hundred times.

I have a very simple approach and way of working with git in curl. This is how it works.

Python leshenko.net

Learn Git internals by building your own with Python

This is not a tutorial on using Git! To follow along I advise that you have working knowledge of Git. If you’re a newcomer to Git, this tutorial is probably not the best place to start your Git journey. I suggest coming back here after you’ve used Git a bit and you’re comfortable with making commits, branching, merging, pushing and pulling.

Player art
  0:00 / 0:00