loading...
Cover image for Stage. Commit. Push. A Git Story (Comic)

Stage. Commit. Push. A Git Story (Comic)

erikaheidi profile image Erika Heidi Updated on ・1 min read

When we're getting started with Git, it can be difficult to understand where our files live, how they change state, and when exactly they leave our local machine to reach the external repository.

I have an analogy for that:

Alt Text

In practice:

  1. Work on your postcard (implement your changes).
  2. Put it on the "staged" pocket when you're ready to commit (git add).
  3. Stamp the postcard (git commit).
  4. When you're ready, put the postcard in the mailbox (git push).

For an actual Git guide, please check out this post from my friend Lisa.

Discussion

pic
Editor guide
Collapse
ghost profile image
Ghost

And has the added bonus of teaching some of us how postcards and stamps work :)

Collapse
okdewit profile image
Orian de Wit

If you're a lazy postcard mailer like me, you can also do everything at the same time.

If you're using the command line, you can add an alias like this, which does both staging and committing and pushing:

alias c='git commit -am $1 && git push origin HEAD'

You can chain commands together with &&, and access passed parameters using $@ (everything) and $1 (first parameter).

I do a lot of little single-commit bugfixes, so one of my most used command line aliases moves my current changes to a new branch, stages and commits, pushes the branch, and opens the page on GitHub to create a PR.

As a developer, one of the most amazing things is how creative you can get in automating your own workflow!

Collapse
erikaheidi profile image
Erika Heidi Author

Wow, this is awesome. Thanks for sharing! 😊

Collapse
raja_anbazhagan profile image
Raja Anbazhagan

What's a post card?

Collapse
jampxrs profile image
James

It's a little card you can send to your friends. They usually are sent when you are visiting a new place (like a tourist destination) and usually have a pretty picture on the front and you write a message on the back.

Collapse
stargator profile image
Stargator

I love the DEV shirt the character is wearing!

Collapse
erikaheidi profile image
Erika Heidi Author

Hah, nice that you got it. 😊 Thanks!

Collapse
gabbersepp profile image
Josef Biehler

Hey, nice illustration. What tools do you use for that?

I am drawing on a MS Surface Pro and sometimes with pen & paper :-)

Collapse
erikaheidi profile image
Erika Heidi Author

Hey, thank you! This was good'ol pen and paper, then scanned from my phone. I tried doing digital drawings many times before and I can't find enjoyment in it. So I kinda settled for doing things old school, haha 😊

Collapse
cameronapak profile image
cameronapak

Are you using a Rocketbook by any change?

P.S. Thanks for making this!

Collapse
fennecdjay profile image
Jérémie Astor

Great work 😄

Collapse
erikaheidi profile image
Erika Heidi Author

Thanks 😊

Collapse
calvinoea profile image
Calvin

Very nice!

Collapse
erikaheidi profile image
Erika Heidi Author

Thank you 😊

Collapse
pavi2410 profile image
Pavitra Golchha

Nice analogy that I have never heard before but it really fits better!

Collapse
hkly profile image
hkly

What a great analogy and comic!

Collapse
erikaheidi profile image
Collapse
maelingmurphy profile image
Maeling Murphy (she/her)

This is so cute and helpful! Thanks for sharing! I've been trying to nail down these steps this week.

Collapse
erikaheidi profile image
Erika Heidi Author

Thank you 😊

Collapse
douglasfugazi profile image