Lexicon
⌘K
Explore
ExploreGuidesNotes
WriteMy LibraryBooks
Sign in
Browse

Bug Bounty

  • Only Bug Bounty Checklist You'll Ever Need!!!
  • Only Bug Bounty Checklist You'll Ever Need!!! V2

Databases

  • Database indexing basics

DevOps

  • How environment variables work

Discussions

  • TCP somethin
  • TCP somethin
  • TCP somethin
  • TCP somethin
  • TCP somethin
  • TCP somethin
  • TCP somethin
  • TCP somethin
  • TCP somethin
  • TCP somethin
  • What's the tcp ip

Git

  • Git commands I use every day

JavaScript

  • JavaScript async and await

Kotlin

  • Kotlin coroutines overview

Linux

  • Useful Linux filesystem commands

Performance

  • How caching improves application performance

React

  • React component design principles

Reference

  • Markdown formatting reference

Software Craft

  • Clean code naming practices
  • Debugging checklist

SQL

  • SQL joins explained

Swift

  • SwiftUI state management

Web

  • API pagination patterns
  • Understanding HTTP status codes
New noteSuggest a guide

Lexicon

a personal knowledge base

← Back to note

Version history

No earlier versions yet — history builds up each time this note is edited.

Current version1 of 1

Git

Git commands I use every day

A short reference of the Git commands I actually reach for daily. Not exhaustive, just the ones that earn their keep.

Checking state

git status            # what changed, what is staged
git status -sb        # compact one-line-per-file view
git diff              # unstaged changes
git diff --staged     # what is about to be committed
git log --oneline -10 # last 10 commits, terse

Staging and committing

git add -p            # stage hunks interactively
git commit -m 'msg'   # commit staged changes
git commit --amend    # fix the previous commit (before pushing)

Use git add -p more than you think. Reviewing each hunk before it lands keeps commits small and honest.

Branching

git switch -c feature/login   # create and switch to a new branch
git switch main               # move back to main
git branch -d feature/login   # delete a merged branch

git switch is the modern, clearer alternative to git checkout for branches.

Undo without panic

GoalCommand
Unstage a filegit restore --staged file
Discard local editsgit restore file
Undo last commit, keep changesgit reset --soft HEAD~1
Recover a lost commitgit reflog then git checkout <hash>

git reflog has saved me more times than I can count. Almost nothing in Git is truly gone for a couple of weeks.

Syncing

git fetch             # download refs, do not merge
git pull --rebase     # replay your commits on top of upstream
git push -u origin HEAD

I prefer pull --rebase so history stays linear instead of sprouting merge commits for every sync.