Quick answer: to rename the branch you're currently on:
git branch -m new-name
To rename a branch you're not currently on:
git branch -m old-name new-name
A space for AI engineers to learn, share, and geek out — covering everything from LLMs and agents to the tools and tricks that make building with AI easier.
Quick answer: to rename the branch you're currently on:
git branch -m new-name
To rename a branch you're not currently on:
git branch -m old-name new-name
Quick answer: run git restore --staged <file> (modern Git) or
git reset <file> (works everywhere) to unstage a file you added by mistake, before it's
committed.
Quick answer: git fetch downloads new commits and updates your local
"remote-tracking" branches (like origin/main) without touching your working files.
git pull does the same fetch, then immediately merges (or rebases) those changes into your
current branch. In short: git pull = git fetch + git merge.
Quick answer:
git branch -d branch_name # delete local branch
git push origin --delete branch_name # delete remote branch
Quick answer: to undo your last local Git commit but keep the changes on disk, run
git reset HEAD~1. To undo the commit and throw the changes away completely, run
git reset --hard HEAD~1. Neither command touches a remote unless you push afterward.