Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

155 Commits

Folders and files

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 150 — Reference issue in commit

Commit Messages · 2026-10-08

git commit -m "fix: crash on startup\n\nCloses #42"

Linking to an issue will auto-close it when merged to main.


Day 149 — Add body to commit

Commit Messages · 2026-10-07

git commit -m "feat: add login" -m "Implements JWT auth with refresh tokens"

Add more context in the commit body after the subject.


Day 148 — Keep subject under 72 chars

Commit Messages · 2026-10-06

git commit -m "feat: short and clear message here"

GitHub truncates messages longer than 72 characters.


Day 147 — perf prefix

Commit Messages · 2026-10-05

git commit -m "perf: reduce bundle size by 30%"

Use perf: for performance improvements.


Day 146 — test prefix

Commit Messages · 2026-10-04

git commit -m "test: add unit tests for login service"

Use test: for adding or updating tests.


Day 145 — refactor prefix

Commit Messages · 2026-10-03

git commit -m "refactor: extract auth logic to hook"

Use refactor: for code restructuring without behavior change.


Day 144 — docs prefix

Commit Messages · 2026-10-02

git commit -m "docs: update README installation steps"

Use docs: for documentation-only changes.


Day 143 — chore prefix

Commit Messages · 2026-10-01

git commit -m "chore: update dependencies"

Use chore: for maintenance tasks that don't change logic.


Day 142 — fix prefix

Commit Messages · 2026-09-30

git commit -m "fix: resolve crash on logout"

Use fix: for bug fixes.


Day 141 — feat prefix

Commit Messages · 2026-09-29

git commit -m "feat: add user authentication"

Use feat: for new features following Conventional Commits.


Day 140 — Push current branch shortcut

Productivity · 2026-09-28

git push origin HEAD

Push current branch without typing its full name.


Day 139 — Show branch in terminal

Productivity · 2026-09-27

# Add to ~/.zshrc: parse_git_branch()

Display current git branch in your terminal prompt.


Day 138 — Pull with rebase by default

Productivity · 2026-09-26

git config --global pull.rebase true

Always rebase instead of merge when pulling.


Day 137 — Auto setup remote tracking

Productivity · 2026-09-25

git config --global push.autoSetupRemote true

Automatically set upstream on first push of a new branch.


Day 136 — Set VS Code as git editor

Productivity · 2026-09-24

git config --global core.editor "code --wait"

Use VS Code for commit messages and resolving conflicts.


Day 135 — Set default branch to main

Productivity · 2026-09-23

git config --global init.defaultBranch main

New repos will use main instead of master.


Day 134 — See git config

Productivity · 2026-09-22

git config --list

View all your current Git configuration settings.


Day 133 — Open repo in VS Code

Productivity · 2026-09-21

code .

Open current directory in Visual Studio Code.


Day 132 — List SSH keys in agent

SSH · 2026-09-20

ssh-add -l

See which SSH keys are currently loaded.


Day 131 — Use SSH instead of HTTPS

SSH · 2026-09-19

git remote set-url origin git@github.com:user/repo.git

Switch remote URL to SSH for password-free push/pull.


Day 130 — Test SSH connection

SSH · 2026-09-18

ssh -T git@github.com

Verify your SSH key works with GitHub.


Day 129 — Copy SSH key to clipboard

SSH · 2026-09-17

pbcopy < ~/.ssh/id_ed25519.pub

Copy your public key to paste into GitHub settings.


Day 128 — Generate SSH key

SSH · 2026-09-16

ssh-keygen -t ed25519 -C "you@example.com"

Create a secure SSH key for GitHub authentication.


Day 127 — Ignore a whole folder

.gitignore · 2026-09-15

echo 'build/' >> .gitignore

Ignore entire build or dist directories.


Day 126 — Ignore all .log files

.gitignore · 2026-09-14

echo '*.log' >> .gitignore

Wildcard pattern to ignore all files with .log extension.


Day 125 — Global gitignore

.gitignore · 2026-09-13

git config --global core.excludesfile ~/.gitignore_global

Set a global gitignore that applies to all repos.


Day 124 — Untrack already committed file

.gitignore · 2026-09-12

git rm --cached filename.js

Stop tracking a file without deleting it locally.


Day 123 — Ignore .env files

.gitignore · 2026-09-11

echo '.env' >> .gitignore

Keep secrets out of your repository.


Day 122 — Ignore node_modules

.gitignore · 2026-09-10

echo 'node_modules/' >> .gitignore

Never commit node_modules — always ignore them.


Day 121 — Create .gitignore

.gitignore · 2026-09-09

touch .gitignore

Create the file that tells Git what to ignore.


Day 120 — Show files changed in commit

Advanced Git · 2026-09-08

git show --stat abc1234

See which files were changed in a specific commit.


Day 119 — Count commits

Advanced Git · 2026-09-07

git rev-list --count HEAD

See total number of commits in the repo.


Day 118 — Archive a repo

Advanced Git · 2026-09-06

git archive --format=zip HEAD > project.zip

Export current repo state as a zip file.


Day 117 — Worktree — work on two branches

Advanced Git · 2026-09-05

git worktree add ../hotfix hotfix/urgent

Check out a second branch in a separate folder simultaneously.


Day 116 — Update submodules

Advanced Git · 2026-09-04

git submodule update --init --recursive

Initialize and update all submodules.


Day 115 — Submodule add

Advanced Git · 2026-09-03

git submodule add https://github.com/user/repo

Include another git repo inside your repo.


Day 114 — Partial stage changes

Advanced Git · 2026-09-02

git add -p

Interactively choose which changes to stage, hunk by hunk.


Day 113 — Find which commit broke something

Advanced Git · 2026-09-01

git log -S "broken function"

Search for commits that added or removed a specific string.


Day 112 — See who changed a line

Advanced Git · 2026-08-31

git blame filename.js

Show which commit and author last changed each line.


Day 111 — Recover lost commit

Advanced Git · 2026-08-30

git checkout abc1234

Use reflog to find the hash and checkout to recover.


Day 110 — View reflog

Advanced Git · 2026-08-29

git reflog

See every action you have done — useful for recovering lost commits.


Day 109 — Bisect to find a bug

Advanced Git · 2026-08-28

git bisect start && git bisect bad && git bisect good v1.0

Binary search through commits to find when a bug was introduced.


Day 108 — Cherry pick a commit

Advanced Git · 2026-08-27

git cherry-pick abc1234

Apply a specific commit from another branch to current branch.


Day 107 — View all aliases

Aliases · 2026-08-26

git config --global --list | grep alias

See all aliases you have configured.


Day 106 — Save stash alias

Aliases · 2026-08-25

git config --global alias.save "stash push -m"

Type git save 'message' to stash with name.


Day 105 — Undo alias

Aliases · 2026-08-24

git config --global alias.undo "reset --soft HEAD~1"

Type git undo to uncommit last change.


Day 104 — Pretty log alias

Aliases · 2026-08-23

git config --global alias.lg "log --oneline --graph --all"

Type git lg for a visual commit graph.


Day 103 — Branch alias

Aliases · 2026-08-22

git config --global alias.br branch

Type git br to list branches.


Day 102 — Checkout alias

Aliases · 2026-08-21

git config --global alias.co checkout

Type git co instead of git checkout.


Day 101 — Short status alias

Aliases · 2026-08-20

git config --global alias.st "status -s"

Type git st instead of git status -s.


Day 100 — Setup Node.js in action

GitHub Actions · 2026-08-19

uses: actions/setup-node@v4\n  with:\n    node-version: 20

Install a specific Node.js version in your workflow.


Day 99 — Checkout code in action

GitHub Actions · 2026-08-18

uses: actions/checkout@v4

Essential first step — clone your repo inside the runner.


Day 98 — Cache dependencies

GitHub Actions · 2026-08-17

uses: actions/cache@v3

Speed up workflows by caching node_modules or other deps.


Day 97 — Use environment secret

GitHub Actions · 2026-08-16

secrets.MY_API_KEY

Access a secret stored in GitHub repo settings.


Day 96 — Run on push to main

GitHub Actions · 2026-08-15

on:\n  push:\n    branches: [main]

Trigger workflow whenever code is pushed to main.


Day 95 — Schedule daily action

GitHub Actions · 2026-08-14

cron: '0 9 * * *'

Run a workflow every day at 9 AM UTC using cron syntax.


Day 94 — Rerun failed workflow

GitHub Actions · 2026-08-13

gh run rerun --failed

Retry only the failed jobs in a workflow.


Day 93 — View workflow run logs

GitHub Actions · 2026-08-12

gh run view --log

Read the full log output of a workflow run.


Day 92 — List workflows

GitHub Actions · 2026-08-11

gh workflow list

See all workflows in the repository.


Day 91 — Trigger workflow manually

GitHub Actions · 2026-08-10

gh workflow run daily.yml

Manually start a workflow from terminal.


Day 90 — Watch a workflow run

GitHub CLI · 2026-08-09

gh run watch

Follow a running workflow in real time.


Day 89 — View workflow runs

GitHub CLI · 2026-08-08

gh run list

See recent GitHub Actions runs.


Day 88 — Search code

GitHub CLI · 2026-08-07

gh search code "useAuth" --language typescript

Search for code patterns across GitHub.


Day 87 — Search repos

GitHub CLI · 2026-08-06

gh search repos "react native starter" --sort stars

Find popular repos matching a topic.


Day 86 — List releases

GitHub CLI · 2026-08-05

gh release list

See all published releases.


Day 85 — Create a release

GitHub CLI · 2026-08-04

gh release create v1.0.0 --title "v1.0.0" --notes "First release"

Publish a new GitHub release.


Day 84 — Assign issue to yourself

GitHub CLI · 2026-08-03

gh issue edit 42 --assignee @me

Assign an issue to yourself quickly.


Day 83 — Close an issue

GitHub CLI · 2026-08-02

gh issue close 42

Close an issue from the terminal.


Day 82 — View an issue

GitHub CLI · 2026-08-01

gh issue view 42

Read a specific issue by number.


Day 81 — List issues

GitHub CLI · 2026-07-31

gh issue list

See all open issues in current repo.


Day 80 — Create an issue

GitHub CLI · 2026-07-30

gh issue create --title "Bug: crash on login"

Open a new GitHub issue from terminal.


Day 79 — Close a PR

GitHub CLI · 2026-07-29

gh pr close 123

Close a pull request without merging.


Day 78 — Merge a PR

GitHub CLI · 2026-07-28

gh pr merge 123 --squash

Merge a pull request using squash strategy.


Day 77 — Checkout a PR

GitHub CLI · 2026-07-27

gh pr checkout 123

Switch to the branch of a pull request locally.


Day 76 — View a PR

GitHub CLI · 2026-07-26

gh pr view 123

Read the details of a specific pull request.


Day 75 — List open PRs

GitHub CLI · 2026-07-25

gh pr list

See all open pull requests in current repo.


Day 74 — Create a PR

GitHub CLI · 2026-07-24

gh pr create --title "feat: new feature" --fill

Open a pull request from current branch.


Day 73 — Fork a repo

GitHub CLI · 2026-07-23

gh repo fork owner/repo

Fork a repository to your account.


Day 72 — View repo in browser

GitHub CLI · 2026-07-22

gh repo view --web

Open current repo in your default browser.


Day 71 — List your repos

GitHub CLI · 2026-07-21

gh repo list

See all your GitHub repositories.


Day 70 — Clone a repo

GitHub CLI · 2026-07-20

gh repo clone owner/repo

Clone any GitHub repository easily.


Day 69 — Create a repo

GitHub CLI · 2026-07-19

gh repo create my-app --public

Create a new GitHub repository from terminal.


Day 68 — Check login status

GitHub CLI · 2026-07-18

gh auth status

Verify you are logged in and see your username.


Day 67 — Login to GitHub

GitHub CLI · 2026-07-17

gh auth login

Authenticate with your GitHub account.


Day 66 — Install GitHub CLI

GitHub CLI · 2026-07-16

brew install gh

Install the official GitHub CLI on macOS.


Day 65 — Delete a tag

Tags · 2026-07-15

git tag -d v1.0.0

Remove a local tag.


Day 64 — Push tags to remote

Tags · 2026-07-14

git push origin --tags

Upload all local tags to remote.


Day 63 — List all tags

Tags · 2026-07-13

git tag

Show all tags in the repository.


Day 62 — Create annotated tag

Tags · 2026-07-12

git tag -a v1.0.0 -m "Release v1.0.0"

Tag with a message — best practice for releases.


Day 61 — Create a tag

Tags · 2026-07-11

git tag v1.0.0

Mark a specific commit as a release version.


Day 60 — Pull with rebase

Remote · 2026-07-10

git pull --rebase

Pull and rebase instead of merge for cleaner history.


Day 59 — Fetch without merging

Remote · 2026-07-09

git fetch origin

Download remote changes without applying them.


Day 58 — Change remote URL

Remote · 2026-07-08

git remote set-url origin https://github.com/user/new-repo.git

Update the URL of an existing remote.


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

Packages

Contributors

Languages