Development tools reference

Git & GitHub Reference

A reference for tracking work, branching, and publishing a repository.

Tracking work

A change moves through three places: your working directory, the staging area, then the repository.

Starting and checking

init begins tracking. status tells you what git currently believes and what to do next.

git init
git status
git log
git log --oneline
  • Run status before adding, after adding, and before committing.

Staging and committing

Staging lets you record some changes and not others, which is what makes a history worth reading.

git add file.txt
git add .
git restore --staged file.txt   # unstage, keeping edits
git commit -m "Fix navigation on mobile"
  • If the message needs the word and, it is probably two commits.
  • Write in the imperative, completing the sentence this commit will.

Seeing what changed

diff shows what is different right now, before you stage it.

git diff              # unstaged changes
git diff --staged     # what is about to be committed

Branching

Branches

A separate line of history, so you can try something without risking what already works.

git branch
git switch -c add-contact   # create and move
git switch main
git merge add-contact
  • Merge into whichever branch you are currently on, so switch back first.

Conflicts

Git asking which version is right, because the same lines changed on both branches.

<<<<<<< HEAD
your current branch
=======
what is coming in
>>>>>>> other-branch
  • Delete the markers, keep what you want, then add and commit.
  • Short lived branches conflict rarely.

Remotes and GitHub

Remotes

A copy of your repository somewhere else. origin is a conventional name, not a keyword.

git remote add origin https://github.com/you/repo.git
git remote -v
git push -u origin main
git pull
git clone https://github.com/you/repo.git

gitignore

Patterns git should pretend it cannot see.

node_modules/
.venv/
dist/
.DS_Store
*.log
.env
  • Write it before the first commit. Anything already committed stays in history.
  • A committed secret must be rotated, not just deleted.

Want to learn how to build with this?

A reference tells you what exists. The course teaches you when to reach for it, and has you build something real while you learn.