Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are 'base' and 'head' repo in GitHub web UI?

GitHub's UI is fairly unintuitive and poorly thought-out, so here's a problem and a question:

What is the "head" repo? What is the "base" repo? I do not know which one is being copied from. The words "base" and "head" mean the same thing. The "head" of a linked list is similar to the "base" of a tree. (GitHub has fork tree and file tree.) "Head" and "base" are synonyms and mean the "start" of a data structure, so these labels are ambiguous.

enter image description here

Despite the arrow in the diagram, it is not apparent which repo is being copied from and which is copied to. They really should have included a "To" and "From" label to clear this up. The word "compare" does not imply directionality. This is really REALLY stupid wording. The arrow could mean "X into Y", or it could mean "Y into X".

like image 470
Ryan Avatar asked Nov 20 '19 23:11

Ryan


People also ask

What is base and head in GitHub?

Base: Base is the repository that will be updated. Changes will be added to this repository via the pull request. Following the example above, the base repo is your colleague's repo. Head: Head is the repository containing the changes that will be added to the base.

What is base and head branch?

Base Branch: The "Base Branch" is the branch where your new changes should be applied / integrated into. Head Branch: The "Head Branch" is the branch that contains the changes you want to integrate.

What is the head of a repository?

The term HEAD refers to the current commit you are viewing. By default, you'll view the tip of the master branch on a repository, unless the main branch of your repository has a different name. The tip of the master branch is the most recent commit on the main branch of your codebase.

What is base branch in GitHub?

The default branch is also the initial branch that Git checks out locally when someone clones the repository. Unless you specify a different branch, the default branch in a repository is the base branch for new pull requests and code commits. By default, GitHub names the default branch main in any new repository.


1 Answers

The terms "head" and "base" are used as they normally are in Git. The head is the branch which you are on; that is, the branch with your changes. The base is the branch off which these changes are based. This is similar to the terminology used for git rebase and git merge-base.

For example, if I'm comparing changes I've made on my foo123 branch against the main Git repository, the base branch is the master branch of git/git, and the head branch is the foo123 branch of bk2204/git. I would be proposing merging my changes on my foo123 branch into the main Git master branch if I opened a pull request.

like image 99
bk2204 Avatar answered Nov 15 '22 07:11

bk2204