Quick reference for the most common Git commands
Check Git version
git --versionSet your name
git config --global user.name "Your Name"Set your email
git config --global user.email "you@example.com"Create a new repository
git initCheck status of files
git statusAdd all files to staging
git add .Add specific file
git add <filename>Save changes with a message
git commit -m "message"View commit history
git logView compact history
git log --onelineList all branches
git branchCreate new branch
git branch <name>Switch to branch
git checkout <name>Create and switch to new branch
git checkout -b <name>Merge branch into current branch
git merge <branch>Delete branch
git branch -d <name>Download a repository
git clone <url>Connect local repo to GitHub
git remote add origin <url>Upload changes to GitHub
git push origin mainPush and set upstream
git push -u origin mainDownload latest changes
git pullPull from specific branch
git pull origin mainView remote repositories
git remote -vShow unstaged changes
git diffShow staged changes
git diff --stagedUnstage a file
git reset <file>Discard changes in file
git checkout -- <file>Temporarily save changes
git stashRestore stashed changes
git stash popTip
Don't try to memorize all commands at once! Copy the ones you need and practice them regularly. They'll become natural with time.