Back to technologies
/git
Git CLI command reference
Everyday Git commands for version control and branch management.
16 matches
Repo Basics
5 commands
git initCreate a new Git repository in the current folder.
git clone <url>Clone a repository from a remote origin.
git statusCheck the current working tree state.
git add .Stage all tracked and untracked changes.
git commit -m "message"Create a commit with a message.
Branching & Sync
5 commands
git switch -c feature/new-uiCreate and switch to a new branch.
git branch -aList local and remote branches.
git pull --rebasePull remote changes with a rebase strategy.
git push -u origin HEADPush the current branch and set upstream.
git merge mainMerge the `main` branch into the current branch.
History & Recovery
6 commands
git log --oneline --graph --decorate --allView a compact visual commit history.
git diffSee unstaged changes in the working tree.
git restore .Discard working tree changes in the current directory.
git reset --soft HEAD~1Undo the last commit but keep changes staged.
git stashTemporarily save local changes.
git stash popRestore the most recent stashed changes.