from xkcd

Fun with Git

a tribute to my most used UNIX command

Prototypr
Published in
4 min readJul 3, 2016

I’ve always wanted to write. I’ve always wanted to tell a story.

Didn’t happen though, at least not yet. That’s not for the lack of trying. I’ve tried but I’m just,

  1. Too technical. Technicalities over imagination.
  2. I get overwhelmed by too many words. #somuchwords
  3. Words get overwhelmed with me too.
seen from an ad

And then one day, I learned how to code.

And I realized that as I code, I also write. I am a writer. An author. Code repos are my books. Collaborators are my readers.

What does it have to do with git? Git makes collaboration easy.

from Fun with Flags by Sheldon Cooper

Let’s have a git refresher today.

History of git

It started with a penguin, the Linux kernel.

From 1991 to 2002, the Linux kernel team passed around code changes as patches and archived files. In 2002, they started using a DVCS called BitKeeper.

Unfortunately after 3 years, the penguin’s heart got broken.

In 2005, BitKeeper became a paid tool and Linus Torvalds started creating git with all the learnings from using BitKeeper.

The penguin found its forever. 💖

The 5 main goals of git

  1. Speed
  2. Simple
  3. Can support multiple parallel branches
  4. FREE
  5. Can support the Linux kernel code

Why was it named git? According to Wikipedia, it was named by Linus Torvalds. He described it’s 2 aspects separately. He described the tool as ‘the stupid content tracker’, and he described the names as (depending on your mood),

a. (when you’re feeling random and lazy) - a random 3-letter combination that is easily pronounceable and not a UNIX command yet.

b. (when you’re feeling witty) - stupid, simple, contemptible and despicable. Take your pick from the dictionary of slang.

c. (when you’re feeling smart, in a good mood, everything just works and the light suddenly fills the room) - ‘global information tracker’

d. (when everything is breaking right in front of you) - ‘goddamn idiotic truckload’

How git works?

Let’s start with a local working directory

When we initialize a local directory to use git by doing a ‘git init’, a folder named ‘.git’ will be created. It is now ready to be distributed. Also, it will be divided into 3 parts

  1. the working directory
  2. the staging area
  3. local repo

In addition, the items inside that local working directory can undergo 3 states

  1. unmodified (default)
  2. modified (changed)
  3. staged (through ‘git add’)

Those staged changes are now ready to be moved to the local repo by doing a ‘git commit’ and to the remote repo by doing ‘git push’

Once the remote repo is updated, collaborators may do a ‘git pull’ to get those changes.

Git Tips

A collection of tips can be found here but I will cite few of my favorites

  1. gitk
  2. git help everyday
  3. git commit — amend
  4. git commit — amend — author
  5. git whatchanged — since=’2 weeks ago’
  6. git fetch, git rebase
  7. git bisect

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Published in Prototypr

Prototyping, UX Design, Front-end Development and Beyond 👾 | ✍️ Write for us https://bit.ly/apply-prototypr

No responses yet

Write a response