Skip to content

Git and Github terms

nivekyee edited this page Apr 24, 2021 · 4 revisions

General terms

origin

The default upstream repository. Most projects have at least one upstream project that they track. By default, origin is used for that purpose.

milestone

A way to track the progress on groups of issues or pull requests in a repository.

fork

A fork is a personal copy of another user's repository that lives on your account. Forks allow you to freely make changes to a project without affecting the original upstream repository. You can also open a pull request in the upstream repository and keep your fork synced with the latest changes since both repositories are still connected. Usages of forks can be to:

  • Propose changes to someone else's project

    For example, you can use forks to propose changes related to fixing a bug. Rather than logging an issue for a bug you've found, you can:

    • Fork the repository.
    • Make the fix.
    • Submit a pull request to the project owner.
  • Use someone else's project as a starting point for your own idea

rebase

To reapply a series of changes from a branch to a different base, and reset the HEAD of that branch to the result.

revert

When you revert a pull request on GitHub, a new pull request is automatically opened, which has one commit that reverts the merge commit from the original merged pull request. In Git, you can revert commits with git revert.

branch

A branch is a parallel version of a repository. It is contained within the repository, but does not affect the primary or main branch allowing you to work freely without disrupting the "live" version. When you've made the changes you want to make, you can merge your branch back into the main branch to publish your changes.

HEAD

A defined commit of a branch, usually the most recent commit at the tip of the branch.

detached HEAD

Git will warn you if you're working on a detached HEAD, which means that Git is not pointing to a branch and that any commits you make will not appear in commit history. For example, when you check out an arbitrary commit that is not the latest commit of any particular branch, you're working on a "detached HEAD."

main ( master )

The default development branch. Whenever you create a Git repository, a branch named main is created, and becomes the active branch. In most cases, this contains the local development, though that is purely by convention and is not required.

compare branch (head branch)

The branch you use to create a pull request. This branch is compared to the base branch you choose for the pull request, and the changes are identified. When the pull request is merged, the base branch is updated with the changes from the compare branch. Also known as the "head branch" of the pull request.

default branch

The base branch for new pull requests and code commits in a repository. Each repository has at least one branch, which Git creates when you initialize the repository. The first branch is usually called main, and is often the default branch.

feature branch

A branch used to experiment with a new feature or fix an issue that is not in production. Also called a topic branch.

topic branch

A regular Git branch that is used by a developer to identify a conceptual line of development. Since branches are very easy and inexpensive, it is often desirable to have several small branches that each contain very well defined concepts or small incremental yet related changes. Can also be called a feature branch.

merge

Merging takes the changes from one branch (in the same repository or from a fork), and applies them into another. A merge can be done through a pull request via the GitHub.com web interface if there are no conflicting changes, or can always be done via the command line. git merge can be used to merge a git fetch to your local repository when a merge conflict is expected.

merge conflict

A difference that occurs between merged branches. Merge conflicts happen when people make different changes to the same line of the same file, or when one person edits a file and another person deletes the same file. The merge conflict must be resolved before you can merge the branches.

Changes to local repository

clone

Usually only done once at the start of a project. A clone is a copy of a repository that lives on your computer instead of on a website's server somewhere, or the act of making that copy. When you make a clone, you can edit the files in your preferred editor and use Git to keep track of your changes without having to be online. The repository you cloned is still connected to the remote version so that you can push your local changes to the remote to keep them synced when you're online.

checkout

You can use git checkout on the command line to create a new branch, change your current working branch to a different branch, or even to switch to a different version of a file from a different branch with git checkout [branchname] [path to file]. The "checkout" action updates all or part of the working tree with a tree object or blob from the object database, and updates the index and HEAD if the whole working tree is pointing to a new branch.-merge

cherry-picking

To choose a subset of changes from a series of changes (typically commits) and record them as a new series of changes on top of a different codebase. In Git, this is performed by the git cherry-pick command to extract the change introduced by an existing commit on another branch and to record it based on the tip of the current branch as a new commit. For more information, see git-cherry-pick in the Git documentation.

commit

A commit, or "revision", is an individual change to a file (or set of files). When you make a commit to save your work, Git creates a unique ID (a.k.a. the "SHA" or "hash") that allows you to keep record of the specific changes committed along with who made them and when. Commits usually contain a commit message which is a brief description of what changes were made.

diff

A diff is the difference in changes between two commits, or saved changes. The diff will visually describe what was added or removed from a file since its last commit.

squash

To combine multiple commits into a single commit. Also a Git command.

pull

A combination of git fetch + git merge. Pull refers to when you are fetching in changes and merging them. For instance, if someone has edited the remote file you're both working on, you'll want to pull in those changes to your local copy so that it's up to date. See also fetch.

fetch

When you use git fetch, you're adding changes from the remote repository to your local working branch without committing them. Unlike git pull, fetching allows you to review changes before committing them to your local branch. git fetch can be used to first update all remote tracking branches before losing network connectivity, and then later try to run git pull.

Changes to remote repository

remote

This is the version of a repository or branch that is hosted on a server, most likely GitHub.com. Remote versions can be connected to local clones so that changes can be synced.

pull request

Pull requests are proposed changes to a repository submitted by a user and accepted or rejected by a repository's collaborators. Like issues, pull requests each have their own discussion forum.

pull request review

Comments from collaborators on a pull request that approve the changes or request further changes before the pull request is merged.

keyword

A specific word that closes an issue when used within a pull request.

push

To push means to send your committed changes to a remote repository on GitHub.com. For instance, if you change something locally, you can push those changes so that others may access them.

push a branch

When you successfully push a branch to a remote repository, you update the remote branch with changes from your local branch. When you "push a branch", Git will search for the branch's HEAD ref in the remote repository and verify that it is a direct ancestor to the branch's local HEAD ref. Once verified, Git pulls all objects (reachable from the local HEAD ref and missing from the remote repository) into the remote object database and then updates the remote HEAD ref. If the remote HEAD is not an ancestor to the local HEAD, the push fails.

force push

A Git push that overwrites the remote repository with local changes without regard for conflicts.

Clone this wiki locally