0% found this document useful (0 votes)
27 views1 page

Github Cheat Sheet

Uploaded by

Saswata Mondal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views1 page

Github Cheat Sheet

Uploaded by

Saswata Mondal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Git & GitHub Basic Commands Cheat Sheet

Category Command Description

Setup git --version Check installed Git version

git config --global user.name "Your Name" Set your username

git config --global user.email "[email protected]" Set your email

Repository git init Initialize a new Git repository

git clone <url> Clone a repository from GitHub

git remote add origin <url> Add a remote repository

Staging & Commit git status Show changes status

git add <file> Stage a file

git add . Stage all changes

git commit -m "message" Commit staged changes

Branching git branch List branches

git branch <name> Create new branch

git checkout <branch> Switch to branch

git checkout -b <name> Create and switch to new branch

git merge <branch> Merge branch into current

Push & Pull git push origin <branch> Push to remote branch

git pull origin <branch> Pull changes from remote

Undo Changes git restore <file> Discard changes in file

git reset --hard Reset all changes to last commit

git revert <commit_id> Revert a commit

Logs git log Show commit history

git log --oneline Compact commit history

GitHub gh repo create Create a repo (GitHub CLI)

gh auth login Login to GitHub via CLI

gh issue list List GitHub issues

You might also like