Github Cheatsheet

Ayush NighoskarAyush Nighoskar
4 min read

JS Array and its Methods (2).png

Overview

This cheat sheet will help any new user to understand the basic git commands.You'll discover what git is and how to utilise it

What is GIT?

GIT is a distributed version control system that is free and open-source. It supports non-linear development to accelerate the development process and provides branching facility for several developers working on the same project.

Git Installation-

You can download and install GIT in your working system from the below link for any platform (Mac, windows Or Linux):

GIT Installation.

And this is the very first step to getting start with the GIT.

Git Setup-

It is pretty easy to setup git in local machine, just you have to understand and run the below commands and that's all to make you have to do to setup GIT.

Configuring user information used across all local repositories

git config --global user.name "[firstname lastname]"

set a name that is identifiable for credit when review version history

git config --global user.email "[valid-email]"

set an email address that will be associated with each history marker

git config --global color.ui auto

set automatic command line coloring for Git for easy reviewing

Git Basic Commands-

Congratulation!🎊 I hope you were able to set up git on your computer now. Once you've set up GIT on your local workstation, you're ready to start learning the fundamental commands for using git to manage multiple versions for your project. So let's get started now.

How to initiate a Git repository is the first command you must learn. To start, open command prompt, go to your project's root directory folder, and run the command below to start git-

git init

to initialize an existing directory as a Git repository

git clone [your repository url]

to retrieve an entire repository from a hosted location via URL

git status

to show modified files in working directory, staged for your next commit

git add [file]

to add a file as it looks now to your next commit (stage). If you have a hell lot file and want to add all of them, just replace [file] with a . and git consider all untracked file and will be added all.

git reset [file]

to unstage a file while retaining the changes in working directory. To unstage all files just you need to type . in place of [file] for the above command.

git commit -m β€œ[descriptive message]”

to commit your staged content as a new commit snapshot

git branch

to list your branches. a * will appear next to the currently active branch

git branch [branch-name]

to create a new branch at the current commit

git remote add [alias] [url]

to add a git URL as an alias

git fetch [alias]

to fetch down all the branches from that Git remote

git merge [alias]/[branch]

to merge a remote branch into your current branch to bring it up to date

git push [alias] [branch]

to transmit local branch commits to the remote repository branch

git pull

to fetch and merge any commits from the tracking remote branch

git checkout

to switch to another branch and check it out into your working directory

git merge [branch]

to merge the specified branch’s history into the current one

git log

to show the commit history for the currently active branch

Conclusion-

Thanks a lot for reading and hope now you know how to use git as version controlling tool for your next project. For more information please checkout the official Git Documentation site. And don't forget to hit a πŸ‘ if you find this article helpful. Happy learning! πŸŽ‰

Resources-

1.If you want to learn how to just push your code to Github step by step then I would recommend you to watch this video-

Quick Method

2
Subscribe to my newsletter

Read articles from Ayush Nighoskar directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Ayush Nighoskar
Ayush Nighoskar

Experienced Software Developer interested in Web Development (MERN stack). Along with my technical skill sets, I possess clear verbal and written communication skills and in due time, am capable enough to do the assigned presentation and solve problems. I am always eager to learn more and improve my skills in various aspects of my career along with the organization.Are you interested in staying up-to-date with the latest tech trends and insights? Follow me for more thought-provoking tech articles that will help you expand your knowledge and skills as a developer.