Thursday, December 3, 2026 | London 11°C · Drizzle
DailyGlimpse

AI

Master Git in 2026: The Ultimate Cheat Sheet of 50+ Essential Commands for Developers

Tech Chaupal with Swati 2 min read

Are you a developer, student, or open-source contributor looking to streamline your Git workflow? This comprehensive Git command cheat sheet covers over 50 essential commands, organized by category, to help you work faster and more efficiently with Git and GitHub.

Git Setup & Configuration

  • git config --global user.name "Your Name" – Set your username
  • git config --global user.email "email@example.com" – Set your email
  • git config --list – View configuration

Daily Git Workflow

  • git init – Initialize a new repository
  • git clone <url> – Clone a repository from remote
  • git status – Check file status
  • git add <file> – Stage changes
  • git commit -m "message" – Commit staged changes

Branching & Merging

  • git branch – List branches
  • git checkout -b <branch> – Create and switch to a new branch
  • git merge <branch> – Merge a branch into current

Remote Repository Commands

  • git remote add origin <url> – Add remote
  • git push -u origin <branch> – Push to remote
  • git pull – Fetch and merge from remote

Git Stash

  • git stash – Save temporary changes
  • git stash pop – Apply and drop latest stash

Undo Changes

  • git reset --hard HEAD~1 – Discard last commit
  • git restore <file> – Discard unstaged changes
  • git revert <commit> – Revert a commit

Git History & Logs

  • git log --oneline – Simplified commit history
  • git diff – View unstaged changes

Git Tags

  • git tag <tagname> – Create a tag
  • git push origin <tagname> – Push tag to remote

Cleanup & Aliases

  • git clean -fd – Remove untracked files
  • git config --global alias.st status – Create alias for status

🎯 Whether you're preparing for an interview or working on daily development, this cheat sheet is your go-to reference. Save it, share it, and level up your version control skills!

React