Here are some notes on git concepts that might be useful to newcomers.
A commit is like "saving a checkpoint" of your code. Assume you divide your work in various steps, like:
A "pull request" is basically saying: here's a bunch of my commits, which add this functionality. I made them on a separate branch or on a fork of your code because that's good practice. I swear, they're good. Can you check them out, approve them, and then "merge" them with your original code so they're available to everyone, pretty please?
Git branches allow you to work on code in isolation. Basically, every branch exists (to simplify) independently of each other. Master (which github is renaming main cause [long story]) is usually the "official" branch. Feature changes are made on other branches, and only when they work and are verified, they're effectively merged with master. This means that you can work in parallel on more changes without your half finished code getting all tangled. I haven't always been the greatest about making branches (cause whatever, I was working alone), but it's really good practice.
You can create a branch with git branch -f name-of-branch
and checkout a branch with git checkout name-of-branch
. To pull (download) a branch from the remote (a.k.a. the code on github) that you don't have on your local machine, you can run git pull origin name-of-branch
. This allows you to pick up from someone else's branch.