My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more
Git 101

Git 101

Anjali Chauhan
·Sep 30, 2021·

2 min read

Hey Beautiful people ❤

Thanks for taking the time to read my blog😊

We'll be learning about Git, Need of Git, Git Vs Github, VCS, basic git commands

Let's get started!

hey anjali, WHY SHOULD I BOTHER ABOUT GIT & GITHUB 🤨?

image.png

Imagine your manager asks you to make a wireframe of a website. You make various folders named animation, UI, Admin, iteration1, iteration 2..... etc. Iteration refers to the enhanced versions after consulting to manager.

Suddenly one day manager asks you to day7 UI was nice, want to proceed with it.

and rug swept from your feet, You absolutely don't have an idea on day 7 what was the code as there is clutter of files in your system with almost no space in memory.

GIT : VERSION CONTROL SYSTEM

image.png

Git is like Tree

As Tree has the main Trunk and other small branches attached to it.

Similarly, Git has a main branch (master) and other branches are attached to it. If these other branches get approved, they merge to the master branch.

DISTRIBUTED VERSION CONTROL SYSTEM (VCS) image.png

image.png

These systems do not necessarily rely on a central server to store all the versions of a project's files.

Every user has a local copy of the repository in addition to the central repo on the server-side.

gitvsgithub.PNG

3 STAGES OF GIT WORKFLOW

image.png

Imagine shopping for clothes on Amazon. You select your choice(git add ),

add those into the cart (staging area),

staging area means that these are the only changes I want to proceed with further.

and finally order/payment (git push).

BASIC GIT COMMANDS

Git is initialised through terminal. Install git bash from here

$ git init

This downloads hidden files in the project folder.

Choosing Files to share

git add yourfilename

or

git add .

this one add all the files

We will save the selected files with a message. Then we ready to share them.

$ git commit -m ''Added my files"

m means message

image.png

image.png

image.png

git2.PNG

image.png

git remote add origin remote URL

remote URL can be found from github

image.png

image.png

image.png

git push origin master

git3.PNG

git status

With this you can see modified files

git log

you or anyone can see commit messages