Table of Content
π Introduction
π Git Terminologies
π Setup of Git and Github on System
π Concept of Github and Git
π Staging
π Merging Conflicts
π Resolving Conflicts
π Some Practices to avoid Conflicts
π Pull Request
π Thank you
Introduction
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.
Git Terminologies
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.
Setup of Git and Github on 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 #οΈβ£.
System Specific Commands β
For Windows
- Download Git from π https://git-scm.com/download/win and install it.
For Mac
- Use this command to download git π
brew install git
For Linux (Ubuntu)
- 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\cmd
if 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>
The 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 π±.
Concept of Github and Git π
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?
Links π
Coming soon...
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 π
Top comments (5)
Thanks, Really helpful content
Welcome sumyya khan. If you want notification π for such amazing content , you can click on the follow button.
Thanks in advance π
sure
Thank you for sharing!
Welcome, Yongchang He π. It's a series so if you want to get a notification for further parts of the blog. You can click on subscribe β.