Melvault

Github Cheat Sheet for Developers

@Gauri Shankar

Forgetting Git Commands? We’ve All Been There

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.

 

Getting Started with Git

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

 

Tracking Changes

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

 

Branching & Collaboration

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

 

Remote Repositories

git remote add origin <url> # Add remote

git push -u origin <branch> # Push branch

git pull origin <branch> # Pull updates

git fetch # Fetch changes

 

Undoing 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

 

Stashing

git stash # Save unfinished changes

git stash pop # Apply and remove

git stash list # View stash entries

 

Tags, Logs & Cherry Picking

git tag <tag> # Tag a commit

git cherry-pick <commit-id> # Copy commit to current branch

git reflog # View all actions

 

GitHub CLI Commands (via gh)

gh repo create # Create repo

gh pr create # Create pull request

gh issue create # Create an issue

 

Best Practices for Git

✅ 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

 
Conclusion

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!

Ready to discuss your project?

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.