Git glossary
For students new to Git and GitHub, below are some helpful terms.
Git can be used from the command line, or through
graphical interfaces such as Atom.
- repository: A collection of files, generally all relating to one project.
A repository for a piece of software might contain all of the source code and
documentation. A repository for a data analysis project might contain all of
the scripts and data files (or links to large data files) used for the analysis.
- clone: The act of copying a repository from a website like GitHub to your
hard drive. You can clone your own repositories as well as other people’s
repositories.
- diff: A display of all of the differences between the current version of
a file and the last version of the file to be committed.
- stage: The act of marking a difference from a diff to be included in the
next commit.
- commit: One or more changes to one or more files. All of the changes
in the commit should have been made for the same reason or goal. A short
commit message is always included to explain why the changes were made.
Nothing is too big or small to be a commit. A commit could fix a minor typo,
add a new function, change a data structure across a dozen files, etc.
- push: The act of uploading all new commits to GitHub or another website,
so that the online version of the repository is in sync with the one on your
hard drive.
- pull: The act of downloading any new commits from GitHub or another
website to the version of the repository that is on your hard drive. If you
are collaborating with other people on a repository, or if you are using
multiple computers to work on the same repository, you will pull often.
- branch: If you want to make some changes that you aren’t sure if you will
keep, you can make a new branch in your repository, then either merge the branch
with the master branch or discard it.
- fork: A copy of someone else’s repository that you have made for yourself,
in your own GitHub account, to modify as you please.
- pull request: This is how a branch or fork is merged into the master
branch (or any other branch, technically) of a repository. After the pull
request is made, the repository owner can decide whether to merge the changes
or close the pull request.