👾 Git - Getting Started Guide for Dummies 👾
Tags: git, github, source, control
Published: 2024-06-06 06:56:39

Note:- This is not an exhaustible tutorial to git. It's meant for people with no knowledge about the subject, to provide an easier transition for them into the world of version control.

### What is Git?
Git is the most popular version control system which lets you manage, share and track your content.

### Why should you care?
Let's say you are working on a project with a team, it's a hassle sharing your code between peer, git solves that. Along side it's other benefits such as tracking your progress over time, it let's you easily and efficiently manage your projects without conflicts, making the process of maintain and sharing your project a breeze.

#### That kinda sounds confusing?

### Step 1 - Download and Install git

[Mac (OSX)](http://git-scm.com/download/mac) • [Windows](https://gitforwindows.org/) • [Linux](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)

### Step 2 - Create your first git

Create a folder and navigate in it through your cmd or terminal (by the way if you are a windows user I would greatly suggest [CMDer](https://cmder.net/) as a CMD alternative.) Then run a git init as defined in the image.


![Create your first git](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ama0m8t5xgoo3qz17osv.jpg)

### Step 3 - First File

Now that we have git initiated in our directory, let's create a new file in our directory. For this example, let's just make a standard text file in our folder. The file can contain anything, for this example, I'm going to use this.


![First File](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/newwr4huipyqhm9a6dhk.jpg)

### Step 4 - Let's add and commit
What do I mean when I say add and commit. So, in your terminal, you tell git what files do you want it to keep a track of (in a way). you can use * instead of the file name to grab everything as I'm going to do here. So go into your terminal and run git add * to add the file. After you are done with that. You type git commit -m "Added TextFile" to commit your changes. Now what I mean by commit- a commit is git's way of saving your files, in their current state, and having a copy of your current project/file you can traceback to at any time, It's git's way of saving something or as we can say commiting to your files. You can commit at the end of everyday or after every minor/major milestone in your project, it's on you. Just remember a commit is basically a point in history you can refer back to at any time. So it's like a journal that keeps a track of your project/files. Now to put the new commands in practice. Here's what you do.


![Add and Commit](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n9n0zm4z0gr9l5jk4a1a.jpg)

## 🎉 Congratulations

You have successfully learned the basics of git.

### But wait.. what good does it serve me again?

While this covers the basics of git, in the very minimum, there is still a lot more to git. Which I do intend to cover in a follow up post to this, since it'll have a little complex terms than this, but nothing too daunting or anything. So you can look forward to that. However, I do want to mention 2 more commands that might come helpful to you.

### Bonus - Clone

While git is operate-able locally on your machine, it's true value shines when it's server over the network. For this you can use services like Github or BitBucket. You can even host your own git server using GitLab. Now let's talk about clone. Imagine you are browsing through Github and looking through all the projects that people created. You know you can clone the whole project in your machine and let git manage the versions of it for you? Well, here's how you do it. I've made a dummy git repository for you guys to clone. All you guys have to do is, go back to your terminal and run git clone https://github.com/hammyasf/git-tutorial.git <folder-name>. Notice that <folder-name> could be anything and it'll create a new folder with the folder-name provided with all the git files of the repository in it.


![Clone Repository](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bdmkaxus5qe57blsbfqe.jpg)

Now you can just cd into the folder and start editing the files like you just learned, being able to add and commit changes to it.

## Thank you for your time 🕰️
In the follow-up post I'll use a more in-depth tutorial on stuff like how to make your own repositories and commit stuff to them and how to update them. Also the concept of branches and merging. So stick around. Thanks 🙏