Skip to content

jahanzaib-iqbal-dev/github-cheatsheet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub & Git Cheatsheet

A new Git/GitHub tip added every day for 365 days. Practical commands for React Native, Node.js, and web developers.

Days

Tips So Far

Day 57 — Add a remote

Remote · 2026-07-07

git remote add origin https://github.com/user/repo.git

Connect your local repo to a remote.


Day 56 — View remote URLs

Remote · 2026-07-06

git remote -v

See the fetch and push URLs for your remotes.


Day 55 — Remove untracked files

Undo · 2026-07-05

git clean -fd

Delete untracked files and directories.


Day 54 — Discard all local changes

Undo · 2026-07-04

git checkout .

Revert all unstaged changes in working directory.


Day 53 — Add forgotten file to last commit

Undo · 2026-07-03

git add forgotten.js && git commit --amend --no-edit

Add a file to the previous commit without changing message.


Day 52 — Fix last commit message

Undo · 2026-07-02

git commit --amend -m "correct message"

Change the message of your last commit before pushing.


Day 51 — Revert a commit

Undo · 2026-07-01

git revert abc1234

Create a new commit that undoes a specific commit safely.


Day 50 — Undo and discard changes

Undo · 2026-06-30

git reset --hard HEAD~1

Completely remove last commit and all changes. Dangerous!


Day 49 — Undo last commit (unstage)

Undo · 2026-06-29

git reset HEAD~1

Uncommit and unstage changes but keep files.


Day 48 — Undo last commit (keep changes)

Undo · 2026-06-28

git reset --soft HEAD~1

Uncommit but keep all your changes staged.


Day 47 — Clear all stashes

Stash · 2026-06-27

git stash clear

Delete all stashed entries at once.


Day 46 — Drop a stash

Stash · 2026-06-26

git stash drop stash@{0}

Delete a specific stash entry.


Day 45 — Apply without removing

Stash · 2026-06-25

git stash apply

Apply stash but keep it in the stash list.


Day 44 — Apply latest stash

Stash · 2026-06-24

git stash pop

Restore the latest stash and remove it from list.


Day 43 — List stashes

Stash · 2026-06-23

git stash list

See all saved stashes.


Day 42 — Stash with a name

Stash · 2026-06-22

git stash push -m "wip: auth screen"

Save stash with a descriptive label.


Day 41 — Stash your work

Stash · 2026-06-21

git stash

Temporarily save changes without committing.


Day 40 — Squash commits

Rebase · 2026-06-20

git rebase -i HEAD~3 # change pick to squash

Combine multiple commits into one clean commit.


Day 39 — Interactive rebase

Rebase · 2026-06-19

git rebase -i HEAD~3

Edit, squash, or reorder the last 3 commits.


Day 38 — Continue after conflict

Rebase · 2026-06-18

git rebase --continue

After fixing a conflict during rebase, continue the process.


Day 37 — Abort a rebase

Rebase · 2026-06-17

git rebase --abort

Cancel a rebase in progress and restore original state.


Day 36 — Rebase onto main

Rebase · 2026-06-16

git rebase main

Replay your branch commits on top of main.


Day 35 — Mark conflict resolved

Merging · 2026-06-15

git add filename.js && git commit

After fixing conflicts, stage and commit to complete merge.


Day 34 — Check merge conflicts

Merging · 2026-06-14

git status

After a conflict, git status shows which files need fixing.


Day 33 — Abort a merge

Merging · 2026-06-13

git merge --abort

Cancel an in-progress merge and go back to before.


Day 32 — Merge with no fast-forward

Merging · 2026-06-12

git merge --no-ff feature/login

Always create a merge commit for cleaner history.


Day 31 — Merge a branch

Merging · 2026-06-11

git merge feature/login

Merge another branch into your current branch.


Day 30 — Push new branch to remote

Branches · 2026-06-10

git push -u origin feature/login

Push and set upstream tracking for a new branch.


Day 29 — Rename current branch

Branches · 2026-06-09

git branch -m new-name

Rename the branch you are currently on.


Day 28 — Delete remote branch

Branches · 2026-06-08

git push origin --delete feature/login

Remove a branch from the remote repository.


Day 27 — Force delete branch

Branches · 2026-06-07

git branch -D feature/login

Delete a branch even if it has unmerged changes.


Day 26 — Delete local branch

Branches · 2026-06-06

git branch -d feature/login

Delete a branch that has been merged.


Day 25 — List all branches

Branches · 2026-06-05

git branch -a

Show local and remote branches.


Day 24 — Modern create and switch

Branches · 2026-06-04

git switch -c feature/login

Newer syntax to create and switch branches.


Day 23 — Create and switch

Branches · 2026-06-03

git checkout -b feature/login

Create a new branch and switch to it immediately.


Day 22 — Switch to a branch

Branches · 2026-06-02

git checkout feature/login

Switch your working directory to another branch.


Day 21 — Create a branch

Branches · 2026-06-01

git branch feature/login

Create a new branch without switching to it.


Day 20 — Discard local changes

Git Basics · 2026-05-31

git restore filename.js

Revert a file back to last committed state.


Day 19 — Unstage a file

Git Basics · 2026-05-30

git restore --staged filename.js

Remove a file from staging without losing changes.


Day 18 — See staged changes

Git Basics · 2026-05-29

git diff --staged

Show changes that are staged and ready to commit.


Day 17 — See what changed

Git Basics · 2026-05-28

git diff

Show unstaged changes in your working directory.


Day 16 — See last 5 commits

Git Basics · 2026-05-25

git log --oneline -5

Limit log output to the last 5 commits.


Day 15 — Pretty log with graph

Git Basics · 2026-05-24

git log --oneline --graph --all

Visualize branches and merges in the terminal.


Day 14 — View commit history

Git Basics · 2026-05-23

git log --oneline

See all commits in a compact one-line format.


Day 13 — Pull latest changes

Git Basics · 2026-05-22

git pull

Fetch and merge changes from the remote branch.


Day 12 — Push to remote

Git Basics · 2026-05-21

git push origin main

Upload your commits to the remote repository.


Day 11 — Add and commit together

Git Basics · 2026-05-20

git commit -am "fix: typo in header"

Stage tracked files and commit in one command.


Day 10 — Commit with message

Git Basics · 2026-05-19

git commit -m "feat: add login screen"

Save staged changes with a descriptive message.


Day 9 — Stage one file

Git Basics · 2026-05-18

git add filename.js

Stage a specific file only.


Day 8 — Stage all changes

Git Basics · 2026-05-17

git add .

Stage every changed file in current directory.


Day 7 — Short status

Git Basics · 2026-05-16

git status -s

Compact version of git status — M = modified, ? = untracked.


Day 6 — Check status

Git Basics · 2026-05-15

git status

See which files are staged, unstaged, or untracked.


Day 5 — Clone a repo

Git Basics · 2026-05-14

git clone https://github.com/user/repo.git

Download a remote repository to your machine.


Day 4 — Initialize a repo

Git Basics · 2026-05-13

git init

Start tracking a project with Git.


Day 3 — Set your email

Git Basics · 2026-05-12

git config --global user.email "you@example.com"

Set your email for all commits globally.


Day 2 — Set your username

Git Basics · 2026-05-11

git config --global user.name "Your Name"

Set your name for all commits globally.


Day 1 — Check Git version

Git Basics · 2026-05-10

git --version

Always know what version of Git you are running.



New tip added every day. Star the repo to follow along!

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages