Forgetting Git Commands? We’ve All Been There You just started working on a new feature. Your code is finally behaving, and now it’s time to commit and push. But suddenly, your mind blanks — “Wait, was it git push -u origin branch-name or something else?”
Sound familiar?
Whether you’re a seasoned developer or just getting started with Git and GitHub, remembering the exact syntax for commands — especially the less commonly used ones — can be frustrating. You might waste precious minutes searching Stack Overflow or scrolling through old documentation just to recall a command you’ve used a dozen times before.
That’s why we created this Git & GitHub Cheat Sheet — a curated, developer-friendly reference to make your version control life easier. Bookmark it, print it, or pin it on your wall. Let’s dive in.
git config –global user.name “Your Name”
git config –global user.email “your.email@example.com“
git config –list # View current config
git init # Start a new repository
git clone <url> # Clone an existing one
git status # View file status
git add <file> # Stage files
git commit -m “msg” # Save changes
git log # View history
git log –oneline # Concise history
git branch <name> # Create a branch
git checkout <name> # Switch to a branch
git checkout -b <name> # Create & switch
git merge <name> # Merge branches
git rebase <branch> # Rebase onto another
git remote add origin <url> # Add remote
git push -u origin <branch> # Push branch
git pull origin <branch> # Pull updates
git fetch # Fetch changes
git reset <file> # Unstage file
git reset –soft HEAD~1 # Undo commit (keep staged)
git reset –hard HEAD~1 # Remove commit entirely
git revert <commit-id> # Revert with a new commit
git stash # Save unfinished changes
git stash pop # Apply and remove
git stash list # View stash entries
git tag <tag> # Tag a commit
git cherry-pick <commit-id> # Copy commit to current branch
git reflog # View all actions
gh repo create # Create repo
gh pr create # Create pull request
gh issue create # Create an issue
✅ Commit Often – Keeps history clean
✅ Write Clear Messages – Avoid “update” or “final”
✅ Branch for Features – One branch = one task
✅ Keep main Deployable – Never break it
✅ Use Tags for Releases – Easier rollbacks
✅ Review PRs Carefully – Catch bugs early
Git is powerful, but it doesn’t have to be intimidating. Whether you’re managing projects solo or collaborating across teams, this cheat sheet is your quick-access memory boost. Keep learning,
keep committing, and never let a forgotten command slow you down again.
Feel free to share this with your team. Happy coding!
Let’s talk about your goals and how we can help bring them to life. Whether you're starting fresh or scaling fast, our team is here to support your digital journey — every step of the way.