DEV Community

Németh Mária
Németh Mária

Posted on

What a Writer Notices When Learning Git

I'm a writer who's learning to code, and Git was the first tool that really slowed me down. Commands like rebase and detached HEAD sounded alarming. Then something clicked: a lot of Git maps onto habits writers already have. Here are the comparisons that helped me, plus a few commands I now use every day.

Commits are like saved drafts with a note attached

Writers keep versions: "draft 2", "draft 2 – shorter intro", "final_FINAL". Git does the same thing, minus the messy file names. Each commit is a snapshot, and the message explains what changed.

The habit that helps most is making commits small and focused, the same way an editor prefers one clear change per round of edits.

Commit messages are tiny pieces of writing

A good commit message works like a good headline: short, specific and active.

Fix broken link in installation guide

The old link pointed to a page that was removed.
Updated it to the current setup docs.
Enter fullscreen mode Exit fullscreen mode

Some conventions I picked up:

  • Keep the first line short, around 50 characters.
  • Use the imperative: "Add", "Fix", "Remove", not "Added" or "Fixing".
  • Leave a blank line, then explain why if it isn't obvious.

"Update stuff" tells your future self nothing. "Fix typo in README title" tells them everything.

Branches are like trying a different version of a chapter

When you want to rewrite a section without losing the original, you make a copy and experiment. A branch does exactly that:

git switch -c new-intro   # start a new branch and move to it
# ...edit files...
git add .
git commit -m "Rewrite introduction for beginners"
git switch main           # go back to the original
Enter fullscreen mode Exit fullscreen mode

If the experiment works, you merge it. If it doesn't, the original never changed.

git diff is track changes

If you've ever reviewed tracked changes in a document, git diff is the same idea: removed lines in one colour, added lines in another. Running git diff before every commit has become my version of proofreading. It's where stray debug lines and half-finished sentences get caught.

Commands I actually use most

As a beginner, I found the full list of Git commands overwhelming. These cover most of my day:

  • git status shows what changed and what's staged
  • git diff shows exactly what changed
  • git add <file> stages a change
  • git commit -m "message" saves a snapshot
  • git log --oneline gives a short history
  • git switch <branch> moves between versions

Still learning

Merge conflicts still make me nervous, and I've only just started reading about rebase. But thinking of Git as version control for writing, which is what it is, made it feel much less foreign.

If you came to coding from a non-technical background, which comparison made Git click for you?

Top comments (1)

Collapse
 
csm18 profile image
csm •

An analogy I got from a YouTube video that clicked for me:

Git commits are like a photo shoot:

  • First, everyone is standing around on the ground (git status).
  • The photographer calls certain people onto the stage (git add file1 file2).
  • Then, he takes a photo, a snapshot of everyone on the stage (git commit -m "some message").
  • If some people are mistakenly called onto the stage, they can be sent backstage for later (git stash).