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.

Posted on by:

erikaheidi profile

Erika Heidi

@erikaheidi

Code sorceress and machine enchantress. Passionate about writing and creating technical content for a variety of audiences.

Discussion

pic
Editor guide
 

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

 

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!

 

Wow, this is awesome. Thanks for sharing! 😊

 

What's a post card?

 

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.

 

I love the DEV shirt the character is wearing!

 

Hah, nice that you got it. 😊 Thanks!

 

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

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

 

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 😊

 

Are you using a Rocketbook by any change?

P.S. Thanks for making this!

 
 

Thanks 😊

 
 

Thank you 😊

 

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

 

What a great analogy and comic!

 

Thank you!

 

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

 

Thank you 😊