๐ง GIT CHEATSHEET for CVS Users
๐ง Setup
bashCopyEditgit config --global user.name "Your Name"
git config --global user.email "you@example.com"
๐๏ธ Start a New Repo
bashCopyEditgit init # Start new repo
git clone git@host:user/repo.git # Clone via SSH
๐ Staging & Committing
bashCopyEditgit status # Show changes
git add file.txt # Stage a file
git add . # Stage all
git commit -m "Message" # Commit
๐ Syncing with Remote
bashCopyEditgit pull # Fetch + merge
git push # Push changes
๐ณ Branching
bashCopyEditgit branch # List branches
git branch new-branch # Create branch
git checkout new-branch # Switch
git switch -c new-branch # Create + switch (modern)
git merge branch-name # Merge into current
๐งน Undo & Cleanup
bashCopyEditgit reset HEAD file.txt # Unstage
git checkout -- file.txt # Discard changes
git restore file.txt # (modern syntax)
๐ Log & Diff
bashCopyEditgit log --oneline # Compact history
git diff # Show unstaged diffs
git diff --cached # Staged diffs
๐ฅ Danger Zone
bashCopyEditgit reset --hard HEAD # Reset all changes
git clean -fd # Delete untracked files
๐ฐ๏ธ Remote via SSH
bashCopyEditgit remote -v # View remotes
git remote add origin git@host:repo.git # Add remote
git push -u origin main # First push