Scott's Recipes Logo

Understanding the Git Development Process

Last Updated On: 2025-09-01 04:31:51 -0400

I recently said to someone “I need to commit my changes” and they asked me “What does that mean?”. For a non software developer, that’s an excellent question. Let’s take a case of a simple problem and walk through what that means in terms of a software commit.

Problem: Fix a spelling error on the home page of your web application.

Here are the likely stages:

  1. As a developer, you pick up a ticket from your ticketing system which says “On our home page, someone misspelled the word change as chang. Can you please fix that?”

  2. You go into your terminal and you start by pulling the latest changes: git pull origin main

  3. Any changes come down. You go into your editor and start looking for the files that make up the home page. This could be one file or many files and you have to identify exactly where the misspelling is located.

  4. When you find it, you correct the spelling.

  5. You then run the test coverage for the application to make sure that that one, innocent change didn’t break something else. Yes that’s unlikely but it isn’t impossible.

  6. When the tests run correctly, you need to commit the change. This starts with a git status command which returns something like this:

    ❯ git status On branch main Your branch is up to date with ‘origin/main’.

    Untracked files: (use “git add FILENAME…” to include in what will be committed) app/controllers/feed_items_controller.rb app/helpers/feed_items_helper.rb app/jobs/crawl_all_feeds_job.rb app/jobs/fetch_rss_feed_job.rb app/models/feed_item.rb app/services/ app/workers/ db/migrate/20250817141104_create_feed_items.rb test/controllers/feed_items_controller_test.rb test/factories/feed_items.rb test/jobs/ test/models/feed_item_test.rb

  7. You then need to give a command like this: “git add app/jobs/crawl_all_feeds_job.rb” and press ENTER.
  8. Or you need to add a batch of files with something like this: bin/porcelain_add feed and that would add all files with the word feed in it. Please note that this is a utility I wrote recently to make bulk adds more efficient (source below). This uses the porcelain mode of git status hence the name. And, no, I don’t know what relevance porcelain has to git.
  9. And now you need to do the “commit” step. This is where you describe the change to the version control system. The reason for this is that down the road, you might need to revert this change and knowing what the change was related to makes this SO MUCH EASIER. It also helps another person who is reviewing the code changes to understand what they are about. This is a command like this:

    git commit -m “Fixed bug in the crawl_all_feeds_job related to new code changes from adding title attribute”

  10. And the final step is to push the changes – git push origin main.

Phew! That’s a lot of work to just fix a single typo. And, yes, there are ways to make it faster. You could say:

git add *
git commit -m "Rollup commit"
git push origin main

That is what is called a “rollup commit” where you just push everything all at once and the commits have a generally crappy commit message. This represents what is referred to as “shitty version control practices” and everyone does it sometime. But the general rule of thumb are what is called “atomic commits” where each commit represents a chunk of related work.

The beauty of git is that it really does keep track of all your changes and you can see this with the git log command. Here are all the changes I committed yesterday from a weekend’s worth of work:

git log --oneline
84b15a5 (HEAD -> main, origin/main, origin/HEAD) new routes
24f473c Shell script to make index file creation with tables easier
3fcc6be Calendar rendering routine
e92996d flesh out master seeding routine
9a51cf8 schema changes
a9f478b more tag lines
85eaf43 Crappy changes to user.rb; needs review
96761dc event_start_at method
f5a456b debugging hook
e674086 new application helper routines
a994477 stylesheet changes including formatting on all form submit buttons
3e248e3 add sidekiq to procfile.dev
0e34d8b more dockerfile changes
e0d299d home page stuff
7ab404d misc docs stuff
062e7ba remaining gemfile changes
babf038 Sidekiq and gemfile changes
5ce7c9e more db migrations
df8be81 All the voting related stuff
80c904b All the comment related stuff
6fe396b news Feed url stuff
8a1e254 News Feed Item stuff
0c8836c Tools for managing google sheets

The weird number on the left is called the git hash and the reason for that is it is a unique identifier so if you need to time travel back to that exact position in the source code, you can simply check it out with a command like:

git co 3fcc6be

And that would give you the code at the moment the calendar rendering routines were implemented.

And this is pretty much the daily workflow for a software engineer. Lather, rinse, repeat.

The Porcelain Add Routine

Here is that porcelain_add routine in case it is useful for you:

cat bin/porcelain_add
#!/bin/bash
 
# Check if a pattern was provided
if [ -z "$1" ]; then
  echo "Usage: $0 <pattern>"
  exit 1
fi

PATTERN="$1"

git status --porcelain | grep "$PATTERN" | awk '{print $2}' | xargs git add%