👩‍💻 Git is an amazing tool that many beginners ignore.

If you've been postponing learning it, here is what you need to start today with 9 quick steps (a thread)👇

#100DaysOfCode #CodeNewbie
2. Is it the same as GitHub?

Git is a version control system.
GitHub is a web hosting service for git repositories: keep a remote copy (in case your PC burns🔥), collaborate with other devs (without deleting each others code)...

You can also use GitLab or other platforms
3. How do I install git?

You can install git easily and quickly by downloading it from the website http://git-scm.com 
4. All set, installed. What now?

Simple, you can start locally (without GitHub/GitLab).

Create a folder with your project name. In the terminal, type:
mkdir MyProject

Then, change directory to the project folder with the command:
cd MyProject
5. Git is all about managing file changes. So we create a simple text file called Hello.txt with the sentence "Hello, I'm learning git" in it.

To do that, we use the command:
echo "Hello, I'm learning git!" >> Hello.txt

(you can also do it with mouse click new file etc)..
6. Now, to the fun part. Tell your computer to treat this as a git folder with the command:

git init

You'll get a message that says "Initialized empty Git repository in <git-repository-path>"
7. Noticed the message mentioned "empty" git repository? But what about our Hello.txt file that is there?

Git doesn't automatically track your files if you don't tell it to do so. We need to tell it to track the Hello.txt file by using the command "add".

git add Hello.txt
8. Now comes the tricky part. "Add" only tells git you would like to add this file to a queue to be committed later. To make git actually save the snapshot/version (aka commit) of your file, you need to commit it by using "git commit"
9. When you git commit, you must specify a message that explains what changes were made to the code. If this is the first commit of that file, you can just write "Initial commit".

git commit -m "Initial commit"

You'll get a message that confirms the changes.
10. Congrats! 🎉 You made your first commit! Now, how can you see if it's really there? You can list the commits starting from the most recent doing "git log"
11. Summing up:
Git init 👉 tells the computer this is a git folder
Git add 👉 stages the file = adds the file to a queue to be committed
Git commit 👉commits the file =
saves that snapshot/version of the file

The image below will help you understand add x commit
12. Great! Now, what if you want to go back to a previous commit? Delete a wrong one? Share my files with others?

Git has many commands to deal with many situations. Here is a cheat sheet that will help you.
13. Sure the best way to learn git is by using it. This website let's you learn git commands in a game environment with visual support : https://learngitbranching.js.org/ 
14. And when you start getting the gist of it, you can practice more free hands here: https://git-school.github.io/visualizing-git 
15. Or better, practice git with your own code. The easiest way is to use a graphical interface so you can see what's happening.

Some of them: GitKraken, Sublime Merge (my current one), GitHub Desktop, Git-Cola
16. Nice🎊, you got to the end of the thread and into the git world \\0/ If you liked it, please don't forget to leave a ❤️ or retweet so it can reach more people

Do you have any git tips? Please share in the comments
You can follow @simonpaix.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled: