Master Git with this command-by-command reference for real-world cloud and infrastructure workflows. Stay version-controlled, clean, and collaborative.
git init # Initialize a local repo
# Clone from remote
git clone <url> # Clone remote repo
# Stage & commit
git add . # Stage all changes
git commit -m "message" # Commit with message
# Push / Pull
git push # Push to remote
git pull # Pull from remote
# Check status
git status # Show working tree status
# Log
git log # View commit history
git branch # List branches
git branch <name> # Create new branch
git checkout <name> # Switch to branch
git switch <name> # Modern switch
git merge <branch> # Merge a branch into current
# Graph view
git log --oneline --graph --all
git cherry-pick <commit> # Apply commit from another branch
git tag # List tags
git tag v1.0 # Create lightweight tag
git tag -a v1.0 -m "msg" # Annotated tag
git push origin v1.0 # Push tag to remote
git remote -v # Show remotes
git remote add origin <url># Add new remote
git fetch # Fetch changes without merge
git pull --rebase # Pull with rebase
# Git stash before switching
git stash # Save uncommitted changes
git stash pop # Reapply stashed changes
# Clean working tree
git clean -fd # Remove untracked files & dirs
git reset --hard HEAD # Reset all local changes
# Bisect to find breaking commit
git bisect start # Begin binary search
git bisect bad # Mark current as bad
git bisect good <commit> # Mark known good commit
git reflog # History of HEAD movements
# Git ignore
nano .gitignore # Add files to ignore
# Git attributes
nano .gitattributes # Define merge/diff rules, LFS etc.
git log --all --decorate --oneline --graph
git remote add origin git@github.com:username/repo.git
git push -u origin main # Push main branch
β¨ Built for modern Git workflows. Donβt use git pull --rebase
blindly unless you know what youβre doing.
π§ Visit the GitHub Page or star the GitHub Repo to support this project.