GIT EXPLAINED 🥨 PART 1⁣⁣⠀

I think git should be a verb like google is, because once you start working with other developers, you’ll git all the time 🕝⁣⁣⠀

Git is a command line tool for tracking any changes you make in your code. It gets especially useful when multiple people have to work on the single project.⁣⁣⠀

What’s all the hype about?⁣⁣⁣⁣⠀

Version control☝🏼 As you add more code to your project, snapshots of the current version get taken and saved in chronological order. So every time you want to go back to the previous version of your index.html or app.js, you can! Version control gets especially useful when you screwed up – just go back in time like nothing happened 🧨 ⁣⁣⠀⁣⁣⠀

Also, git is a de facto standard. You’ll find it being used in most, if not all, companies nowadays.⁣⁣⠀

The bad news is, git takes time and practice to learn. ⁣⁣⠀⁣⁣⠀

Good news again, you don’t need to know all git commands to be able to work in a team! Before we can learn commands that you will use in your developer’s job day to day, we need to take a look at some basic git concepts first. ⁣⁣⠀

BASIC GIT CONCEPTS ⁣⁣⠀
👉🏼 𝗕𝗿𝗮𝗻𝗰𝗵 ⁣⁣⠀

A version of the project that diverges from the main one which is called master. You’re normally not supposed to change the master branch. Instead, you create other branches and take changes from the master. You have to keep master up to date to avoid potential conflicts. ⁣⁣⠀

👉🏼 𝗖𝗼𝗺𝗺𝗶𝘁⁣⁣⠀

Is a command that captures a snapshot of the project’s changes. Committed snapshots are “saved” versions of a project on your local machine. ⁣⁣⠀

👉🏼 𝗠𝗲𝗿𝗴𝗲⁣⁣⠀

Merging your branch into master means that you take the changes from your branch and add them into the master branch. ⁣⁣⠀

Three main states of files in git: ⁣⁣⠀

👉🏼 𝗠𝗼𝗱𝗶𝗳𝗶𝗲𝗱

You have changed the files that have not been committed the to your local database. ⁣⁣⠀

👉🏼 𝗦𝘁𝗮𝗴𝗲𝗱

You have files that are “prepared” to go into next commit.⁣⁣⠀

👉🏼 𝗖𝗼𝗺𝗺𝗶𝘁𝗲𝗱

The data is safely stored in your local database.⁣⁣⠀

In the Part 2 of GIT EXPLAINED we will take a look at a typical git workflow or how you’d use git on a normal work day as a software engineer ☀️⁣⁣⠀

Download git cheat sheet