Hey awesome developer 👨💻,
If you are searching or a cheat sheet to go through for git or want to learn about git and github.
Then you are in the right place 😇 !
This is going to be my first series and please comment below about any enhancements that I can make or your feedbacks. Believe me it really helps ✍!
I will be using graphics to explain each topic in the simplest way possible so you can search by the keyword if you want to skip any portions ( in case of using it as cheat sheet ) 🤓
❗Note:- I will be using a windows machine 🖥 to do all the stuffs so there can be a case that the commands may differ if you are using some different machine. Please browse it if the command doesn't work for your system though I will try my best to provide you with the command in such scenarios. Thank you.
First let's understand what is git and some terminologies that we need to get started with it.
Commits: These are the small changes of code that are pushed to the branches.
Branches: These are the different branches of code that are running concurrently and would be merged to the main branch when completed.
Repositories: It is the project which saves all the branches and the commits.
Let's understand it easily with a diagram-
Here the tree 🌳 is the repository, the branches are the branches of the tree and the leaves 🌿 are the commits . Got it ?
Let's now move to the next part which is setting up git and github on your system.
- Create an account on Github
- Go on 👉 https://github.com/
- Click on Sign up and create an account ✅.
- Now create a new repository by clicking on New button near Repositories.
- Type a name for the Repository and click on Create Repository to create one.
- Click on the copy to clipboard icon to copy the link #️⃣.
- Download Git from 👉 https://git-scm.com/download/win and install it.
- Use this command to download git 👉
brew install git
- Use this command to download git 👉
sudo apt-get install git
- Don't forget to put git folder location on environment variables for windows. To add it go to Environment Variables > (System Variables) Path > Paste
C:\Program Files\Git\cmdif you haven't installed it on any other location.
- Now use these commands to clone the repository on your system 👇
mkdir <project_name> git clone <repository_url>
repository_url is the url that you copied to your clipboard from Github.
Great, you are done with the setup you needed for git 🙂. Now let's understand the concept of Git and Github on a grass root level 🌱.
Before digging into git and github we need to understand , CVCS and DVCS to get the hang of the systems of version control.
There are two types of version control-
- Central Version Control System ( CVCS ) - In this system there is a server where all the commits are saved on internet and every single commit are sent to the server through internet.
- Distributed Version Control System ( DVCS ) - In this system there is a main server which is on internet but in addition to this there is one more server which is the user's system so every commits are saved on the users system and history of all commit's are on user's own server and while pushing it get's sent to the main server through the internet.
Now I know many of you are wondering why we are studying these version control system. How is this connected to Git and Github. Right?
So, the answer is Git follows DVCS so Github, GitLab and all other services based on Git also does the same.
I know ! I know ! There are many questions that are popping in your mind so let's talk about Git now. How it really works❓
Git is a service that is based on DVCS, it maintains a remote server on your system. That means your system is also a server while you are using git. As you make a commit , the changes are push to your remote server. You knew that ?
But if you push the commit's then those commit's are sent to Github through internet. Yes here Github is the main server which has all the commits saved and as you push the commit's someone else can pull the changes from main server to their system. Got it?
All the links to future blogs of the series will be listed here.
We will be covering all beginner and advanced commands, along with various visual graphics ✌.
If you want to get the notification 🛎 of the upcoming blogs, don't forget to follow 👥 and subscribe.
Thank you 🙏
And at last I want to say 👇
Keep coding #️⃣ , keep rocking 🚀