Sure Suchit!
Here's a list of important and commonly used Git commands — categorized
for easier understanding:
1. Git Setup & Configuration
git config --global user.name "Your Name"
git config --global user.email "
[email protected]"
2. Repository Basics
git init # Initialize a new Git repo
git clone <repo-url> # Clone remote repo to local
git status # Check current status
git add <file> # Stage a specific file
git add . # Stage all changes
git commit -m "Your message" # Commit with message
3. Branching
git 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 to branch
4. Pushing & Pulling
git push # Push changes to remote
git push -u origin <branch> # Push and set upstream branch
git pull # Pull latest changes from remote
git fetch # Fetch latest branches and commits
5. Merging & Rebase
git merge <branch> # Merge branch into current branch
git rebase <branch> # Rebase current branch onto given branch
6. Stashing Changes
git stash # Save uncommitted changes
git stash apply # Apply latest stashed changes
git stash list # List all stashes
git stash drop # Delete the latest stash
7. Log & History
git log # Show commit history
git log --oneline # Compact log view
git diff # Show changes not staged
git diff --staged # Show staged changes
8. Undo & Reset
git reset --soft HEAD~1 # Undo last commit, keep changes staged
git reset --mixed HEAD~1 # Undo last commit, keep changes unstaged
git reset --hard HEAD~1 # Completely remove last commit
git checkout -- <file> # Discard changes in a file
9. Remote Management
git remote -v # View current remotes
git remote add origin <url> # Add remote origin
git remote remove origin # Remove a remote
10. Tagging Releases
git tag v1.0 # Create a tag
git tag -a v1.0 -m "message" # Create an annotated tag
git push origin v1.0 # Push tag to remote
If you want a printable cheat sheet PDF or want to practice Git hands-on using GitHub,
I can help with that too. Just say the word!