Commit reference
A commit reference is a way to refer to specific commits when running Git commands. It can be commit hashes, branch names, tags, or special references such as HEAD~2
. Commit references allow you to navigate through the commit history and perform operations on specific commits.
There are multiple ways to refer to commits. Here are the most common ones:
-
The full SHA-1 hash (e.g.,
346ca091076783c70623aba03fb7139d3d27134f
). -
A shortened SHA-1 hash (the first few characters, usually the first 7, for example,
346ca09
). -
Tags: These are human-readable names (e.g.,
v1.0
) that can be assigned by you to specific commits. We'll cover tags in just a bit. -
Branch names: These are pointers to the latest commit in a branch. Branches (e.g.,
main
,new-dashboard-feature
) are the parallel lines of development in Git. We'll cover branches later as well. -
HEAD
: This is a special reference that points to the latest commit in the current branch. -
Relative references (e.g.,
HEAD~5
, which means the fifth commit beforeHEAD
, orHEAD^
, which means the commit before the latest).
Hi! I'm Alex, creator of GitByBit.
And this is Gitopedia—a reference that summarizes knowledge in my Git course.
Gitopedia is designed to be a personal knowledge base. When you progress through the main Git course in VS Code, you unlock all of these topics, one by one, bit by bit. This gives you time to digest the information and gradually build the mental model of Git. Here's an example of how it works:
Learning directly in VS Code lets you practice Git exactly as you would in real life, doing real jobs, writing real code. In addition, the course has access to your actual terminal, so it can point out mistakes, suggest workarounds, etc.
The course is FREE, there are no Ads or other bullshit. There are optional premium add-ons you can purchase, mainly to support my work (regrettably, I have to eat every day), but that's totally up to you.