Git
Git Complete Commands Cheat Sheet for Developers
September 15, 2025•3 min read•3 views
Git
StackQuill
Git Complete Commands Cheat Sheet for Developers
Git is one of the most essential tools in a developer’s workflow. Whether you’re working on solo projects or collaborating in a team, having the right Git commands at your fingertips can save time and avoid mistakes.
Here’s a complete Git commands cheat sheet you can bookmark for quick reference 🚀.
🔧 Set Git Global Config (Only once per machine)
bashgit config --global user.name "Your Name" git config --global user.email "you@example.com"
📁 Initialize or Clone Project
bashgit init # Start a new Git repo git clone <repo-url> # Clone an existing remote repo
🌐 Set or Change Remote Repo
bashgit remote add origin <repo-url> # Add remote repo git remote set-url origin <new-url> # Change existing remote git remote -v # View current remotes
📄 Track Changes & Make Commits
bashgit status # Show current changes git add . # Stage all changes git add <file> # Stage specific file git commit -m "your message" # Commit staged changes
🚀 Push & Pull Code
bashgit push # Push to default remote git push -u origin main # First push and set upstream git push origin <branch-name> # Push specific branch git pull # Pull latest from remote git pull origin <branch-name> # Pull from specific branch
🌿 Branching
bashgit branch # List all branches git branch <branch-name> # Create new branch git checkout <branch-name> # Switch to branch git checkout -b <branch-name> # Create & switch branch git merge <branch-name> # Merge into current branch
📤 Push Workflow (Push Request)
bashgit status git add . git commit -m "changes" git push origin <your-branch>
🔄 Pull Workflow (Pull Request)
bashgit status git stash -u # Save all local changes git pull origin <branch-name> git stash apply # Reapply stashed changes
🌱 Create Branch, Make Changes, Return
bashgit checkout -b <new-branch> # make changes git add . git commit -m "updated something" git checkout <old-branch>
📦 Push New Branch to Remote
bashgit push --set-upstream origin <new-branch-name>
🔃 Rebase Feature Branch with Master
bashgit checkout <your-feature-branch> git rebase master
📥 Clone & Create New Branch from Another
bashgit clone <repo-url> cd <project-folder> git checkout <existing-branch> git checkout -b <new-branch>
🔧 Utilities
bashgit stash # Temporarily save changes git stash pop # Reapply stashed changes git log # View commit history git reset <file> # Unstage a file git rm <file> # Remove file from Git & disk
🎯 Final Thoughts
Git can feel overwhelming when you’re just getting started, but once you memorize the core commands, it becomes second nature. This cheat sheet is designed to cover the most common and practical Git workflows that every developer needs.
👉 Save this, share with your team, and level up your Git game!