Git
It is a version control system, which is a tool used to manage changes to code, programs, documents and other information stored as computer files.
GitHub
It is a hosting platform that allows developers to create, store, and manage their code. On Github you can upload your code to a public or private space on the internet.
Git Cheatsheet
Here are some of the most common commands you’ll need to know:
For Config
git config --global user.name "Your Name"
git config --global user.email "youremail@domain.com"
bash
To View Username, Email and Other Details
git config --list
bash
To Get Help
git help
bash
Initialize a Repository
git init
bash
To Add File or Files To Staging Area
git add filename
git add .
bash
To Commit Change
git commit -m 'Short and Sweet Message'
bash
Clone Existing Repository
git clone <project_url>
bash
Checking the Status Files
git status
bash
View Difference
git diff
bash
To Remove File From git
git rm filename
bash
To Move File
git mv file_from file_to
bash
To View Commit History
git log
bash
To Work With Remote Repository
git remote show origin
git remote -v
git remote add origin
git push origin
git pull
bash
To Create Branch
git branch
bash
To Switch Branch
git checkout
bash
To Merge Branch
git merge
bash
To Delete Branch
git branch -d
bash
To Create Tag
git tag
bash
To Push Tag
git push origin
bash
To Delete Tag
git tag -d
bash
To Push All Tags
git push origin --tags
bash
To Delete Remote Tag
git push origin :refs/tags/<tagname>
Quick Start Example
Here’s how you can push your first project to GitHub:
git init
git remote add origin https://github.com/kaushen078/your-repo-name.git
git add .
git commit -m "Initial commit with all files"
git branch -M main
git push -u origin main