Search notes:

branch [git]

A branch is merely a label that points to a commit object. The branch consists of this commit and all of its parent commits.
The commit object that the branch points to is referred to as the branche's tip commit.
A branch is an object with two children.
A branch is an active line of development: Git commands operate on the «current branch».
A repository can track an arbitrary number of branches.
A working tree is associated with exactly one of these branches: the current branch.
A new branch is created with git switch -c. Without -c (or -C), git switch changes the branch to an existing one.

Current branch

See also: HEAD.

master / main

main (an the deprecated older name master) refer to the default development branch, created along with a new repository.

Four types of branches

There are four types of branches
git branch -r shows remote branches, git branch -a shows all branches.
Mark Longair on the other hand argues that there are only two types branches:

Fetching a branch

Fetching a branch means to get the branch's head ref from a remote repository to find out which objects are missing from the local object database, and to get them, too.
man git-fetch.

Tip of the branch

The most recent commit on a branch is referred to as the tip of that branch.
The tip of the branch is referenced by a branch head. This branch head moves forward as further commits are made in that branch.
TODO: When merging, the tips of two branches are unified in a new commit object.

Integrate changes from one branch into another

There are two main commands to intergrate changes from one branch into another:

View content of another branch

With git gui browser, a GUI-browser is opened that shows a given branch's tree and content withouth switching to that other branch:
git gui browser the-name-of-the-other-branch
git show the-name-of-the-other-branch:path/to/file.txt

head

A named reference to the commit at the tip of a branch, stored in the .git/refs/heads directory (except when using packed refs).
A synonym for head is head ref.

index

A collection of files with stat information, whose contents are stored as objects. The index is a stored version of your working tree. Truth be told, it can also contain a second, a even a third version of a working tree, which are used when merging.

index entry

The information regarding a particular file, stored in the index. An index entry can be unmerged, if a merge was started but not finished (i.e. if the index contains multiple versions of that file).

topic branch

A branch that is used by a developer to identifiy 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 smallincremental yet related changes.
To find the tip of a topic branch, run git log --first-parent master..pu and look for the merge commit. The second parent of this commit is the tip of the topic branch.

local branches

Apparently, local branches are defined in .git/refs/heads

Detached branches

Any checkout of a commit that is not the name of one of your branches will get you a detached HEAD (i.e. by checking out a remote branch without first tracking it.

Upstream branch

Apparently, a branch can be associated with an upstream branch:
$ git branch
* fixSomething
  master
$ git push origin
fatal: The current branch fixUsage has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin fixSomething

Unborn branch

The documentation for git diff makes reference to an «unborn branch», whatever that is.

See also

checkout, git branch, pull, git show-branch, git filter-branch

Index