DEV Community

Cover image for 5+1 Basic GIT Commands you Need for Hacktoberfest 2022
Leonardo Montini for This is Learning

Posted on • Updated on • Originally published at leonardomontini.dev

5+1 Basic GIT Commands you Need for Hacktoberfest 2022

Hacktoberfest is starting tomorrow!! Are you ready??

In case you're quite new to git, I will try to explain in a simple way how to use the basic commands you absolutely need to contribute to Open Source.

Disclaimer: this tutorial is meant for beginners. I will oversimplify a little bit to make sure the concepts can be easily understood by someone who might have never used git or has little experience.

The commands are:

  1. clone -> Copy a remote repository in your computer.
  2. checkout -> Create a new branch.
  3. add -> Put your local changes in the stage area.
    • status -> Not mandatory, just to see the current state is all as expected.
  4. commit -> Take a snapshot of the stage area (the file you just added).
  5. push -> Upload your commit(s) to the remote repository.

Technically, you could do all these steps even without commands in terminal but with a GUI (Graphical User Interface) such as GitHub Desktop or Sourcetree, however since git is such a widespread and useful tool you're gonna use everyday, you must know at least the basics.


If you want to see how these commands can be used in a real case, you can watch this video I just uploaded on my YouTube Channel where i talk about Open Source and Web Development!

Youtube Video


Thanks for reading this post, I hope you found it interesting!

Feel free to follow me to get notified when new articles are out ;)

Do you like my content? You might consider subscribing to my YouTube channel!
You can find it here:
YouTube

Top comments (4)

Collapse
 
jmfayard profile image
Jean-Michel πŸ•΅πŸ»β€β™‚οΈ Fayard

Alternatively you can skip the git cli together and install GitHub desktop

desktop.github.com/

Collapse
 
balastrong profile image
Leonardo Montini

Yes, it's written in the article and I also mention GitHub Desktop in the video :)

However, I think we as developer should get used to work with the cli, at least for the basic commands.

Do you think for a beginner is better to use a GUI that makes it easy but doesn't teach them what is going on, or rather spend a little bit more time in learning the basic git commands that also comes with more knowledge and awereness of the tool?

Collapse
 
jmfayard profile image
Jean-Michel πŸ•΅πŸ»β€β™‚οΈ Fayard • Edited

I respectfully disagree.

For me what matters is what helps people to learn the concepts and what hinders it. The accidental complexity of the GIT CLI is in my opinion a major obstacle to learning.

It's not GUI vs terminal applications. If you like the terminal I recommend to use GitHub CLI and/or lazygit

Beginners should follow this advice IMHO

Again this is my personal advice that doesn't universally apply. If you are an hardcode C programmer working in project similar to the Linux Kernel project (Bazaar style), then the git CLI is the best possible tool, because it was designed by and for them.

Thread Thread
 
balastrong profile image
Leonardo Montini

Thank you so much for sharing this article, I'll read it carefully :)