Git Cheat Sheet

Posted on Dec 25, 2020

What is Git ?

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

Installing git

sudo apt install git      [ Debian/Ubuntu ]
sudo yum install git      [ RedHat/CentOS ]
sudo pacman -S git        [ Arch/Manjaro ]
sudo dnf install git      [ Fedora ]
sudo zypper install git   [ OpenSUSE ]
sudo brew install git     [ MacOS ]

Configuring username, email, editor

$ git config --global "Priyanshu Tiwari"
$ git config --global ""

Intializing local git repo

Creating upstream to the remote repo

Cloning remote repo

Working with branches

Commiting changes

Pushing changes

Fixing conflicts

Merging and deleting branch

Undoing bad commits

Rewriting commit history

What is Github

GitHub, Inc. is a provider of Internet hosting for software development and version control using Git owned by Microsoft.

Adding ssh key

ssh-keygen -t ed25519 -C "email"

eval "$(ssh-agent -s)"

ssh-add ~/.ssh/id_ed25519

cat ~/.ssh/

Adding gpg key