| Term | What it means |
|---|---|
| Repository | A project folder that remembers every version |
| Commit | A checkpoint, with a note saying why |
| Branch | A safe place to be wrong |
main |
The branch that should always work |
| Fork | Copy a repo into your own GitHub account |
| Clone | Copy a repo down onto your computer |
| Push | Send your commits up to GitHub |
| Pull | Bring everyone else's commits down to you |
| Pull request | Ask a maintainer to take your changes |
| Merge | Your changes become part of the project |
- Fork the repo — button, top right
- Create a branch named after yourself
- Add or edit your file in the GitHub editor
- Commit with a message that explains the change
- Open a pull request against the original repo
- Reply to review comments, wait for the merge
git config --global user.name "Your Name"
git config --global user.email "you@example.com"Use the email on your GitHub account, or your commits won't be linked to your profile.
git pull # get the latest before you start
git status # where am I? what changed?
git add . # stage everything you changed
git commit -m "..." # checkpoint, with a reason
git push # send it up to GitHubgit branch # list branches (* = current)
git checkout -b my-fix # new branch, switch to it
git checkout main # switch back to main
git log --oneline # history, newest firstgit clone <your-fork-url> # after forking on GitHub
git checkout -b my-name # make your branch
git add . # stage your edit
git commit -m "Add me" # checkpoint it
git push origin my-name # send the branch upThen open the pull request on GitHub — that step is the same either way.
| Bad | update · fix · changes · final v2 |
| Good | Add Anjula to contributors page |
| Good | Fix broken link in README |
git status # always start here
git diff # exactly what you changed
git checkout -- <file> # undo changes to a file
git log --oneline # find a commit to revisit- Pull before you start working. Every time.
- Commit small and often, not once at the end.
- Never commit passwords, keys or
.envfiles. - Use
.gitignorefornode_modulesand build output. - Ask on the issue before starting work on it.