Skip to content

Files

git

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Feb 28, 2025
Jul 5, 2024
Oct 17, 2018
Sep 26, 2023
Jan 21, 2025
Nov 6, 2018
Dec 10, 2018
Aug 9, 2022
Jun 5, 2018
Sep 5, 2017
Jul 24, 2024
Mar 21, 2025
Nov 6, 2017
Mar 21, 2025
Jun 5, 2018
Oct 31, 2017
Apr 20, 2024
Jul 12, 2022

General Git Information

A list of object types and good diagram showing their relationships can be found in this SO answer. (This discusses only objects and should be supplemented with the information in ref.)

Object can be displayed with git cat-file TYPE OBJECT. Batch output options are also available. The following options omit the type:

  • -t: show object type (blob, tree, commit, tag, …)
  • -p: pretty-print.
  • -e: check for existence.
  • <ref>: A "branch" name (mutable pointer) in the local repo. Stored under .git/refs/….
  • <object> The name (SHA1) of any type of object
  • <blob>, <tree>, <commit>: The name of a specific type of object
  • <type>: one of the git object types: blob, tree, commit, tag
  • <file>: file path usu. relative to tree described by GIT_INDEX_FILE

<commit-ish> and <tree-ish> are taken by commands that eventually want to operate on a particular <commit> or <tree>; tags, refs, <commit>s will be deferenced until reaching one.

Specifying a Commit-ish or Tree-ish

The gitrevisions(1) manpage has full details of ways to specify revisions, ranges of revisions and trees. Chapter 7.1 Revision Selection in Pro Git offers a useful tutorial. A short table summarizing some (not all) of this is in this SO answer. These include:

Commit-ish/Tree-ish:

  • SHA1 of commit (or tree).
  • Output of git describe.
  • Using @... for HEAD or refname@...:
    • @{date} where date is yesterday, 2 days 3 minutes ago, 2018-03-11 13:22:17, etc.
    • @{upstream}, @{u}: upstream of given branch.
    • @{push}: local tracking ref of the remote ref to which we'd push if the given ref was checked out. Different from {upstream} when we're pushing to a different place whence we pull.
    • @{n}: nth previous value of given ref (0 = current) from reflog.
  • @{-n} (no refname before @): nth branch/commit checked out before the current one.
  • rev~, rev~n: nth generation ancestor, following first parents (^1)
  • rev^, rev^n: select nth direct parent (default 1) of given commit. Parent 0 is the commit itself rather than a parent.
    • May be repeated, e.g., rev^^2^1.
    • Append {commit}, {tag} or {tree} to select that object type.
    • Append {} to dereference recursively until non-tag is found.
    • Append {/regexp} to match commit with regexp in commit message.
  • :/regexp: Youngest commit reachable from any ref with message matching regexp.

Commit Ranges

a..b gives all commits that are part of b and not part of a. E.g., master..dev gives all commits on branch dev that are not on branch master.

a...b gives all commits that are a part of either a or b but not both. Probably you want to use --graph with multiline output when these are separate branches.