Git & GitHub
Commit, push, pull, merge, undo mistakes, read history.
First-time setup
New project
Create a repo and push a new project to GitHub
You have a local folder (like this one) that is not in Git yet, and you want it on GitHub, ready to connect to Vercel.
Clone an existing project to a new computer
The project is already on GitHub and you want a working copy on this PC.
Daily workflow
What did I do?
What did I do? Read status, log and diff
You came back to the project after a while and need to know where things stand and what you changed.
What changed since my last push, or on GitHub?
You need to know what is only on your PC, and what is only on GitHub, before you pull or push.
Find when (and why) something changed
A line, file or word changed and you want to know which commit did it.
Sync with remote
Fetch or pull? Get GitHub's changes safely
GitHub may have newer commits (another PC, a merged PR) and you want them locally.
I changed things and GitHub changed too: pull, merge, push
You worked directly on main locally, GitHub also has new commits (another PC, a merged PR), and you need to combine them and push.
Update my feature branch with the latest main
You are working on a branch and main has moved on. Bring main's changes into your branch before you finish.
Merge my finished branch into main and push
The work on your branch is done and tested, and you want it live on main (and so on Vercel production).
Rebase or merge? Which one should I use
You have seen both words and are not sure which to use to bring in new commits.
Branches
Create and switch branches
You want to try a change without touching main, or jump between pieces of work.
Branch, pull request, preview, merge (safest flow for a live site)
You want to change the live site without risking it: test on a Vercel preview and merge only when happy.
Delete old branches (local and on GitHub)
Finished branches are piling up and you want to clean up.
Fix mistakes
Undo my last commit (not pushed yet)
You committed too early, with the wrong message, or included a file you should not have, and you have not pushed.
Undo a commit that is already pushed (revert)
A bad commit is on GitHub (maybe live on Vercel) and you want to undo it without rewriting history.
Unstage a file or discard my edits
You staged something by mistake, or you want to throw away edits and return a file to its last committed state.
Recover lost commits with the reflog
You reset, rebased or deleted a branch and now commits or work seem to be gone.
Conflicts & rejections
Housekeeping
Keep files and secrets out of Git (.gitignore)
You must not commit node_modules, .env, build output, or secrets, or you already did.
Fix the LF / CRLF line-ending warnings on Windows
Git prints LF will be replaced by CRLF, or whole files look changed when you only touched one line.
No scenario matches that filter.