
Basic Workflow
git init Initialize a Git repository
git clone <url> Clone a repository
git status Check current status
git restore <file> Discard unstaged changes
git add <file> / git add . Stage changes
git commit -m "Message" Commit changes
git commit --amend -m "New message" Update the last commit
git fetch origin Pull remote changes without merging
git pull origin <branch> Pull latest changes
git push origin <branch> Push commits
git push -u origin <branch> Push a new branch and set upstream tracking
Branching
git branch List local branches
git branch <branch> Create a new branch
git checkout <branch> Switch branch
git checkout -b <branch> Create and switch to a new branch
git merge <branch> Merge a branch
git branch -d <branch> Delete a local branch