๐Ÿง  GIT CHEATSHEET for CVS Users

๐Ÿง  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

Leave a Comment

Your email address will not be published. Required fields are marked *