By admin , 28 April 2026

Introduction

The merge base of two commits is their best common ancestor: the foundation Git uses for three-way merges. Choosing the right base is what makes "automatic" merges actually work.

By admin , 28 April 2026

Introduction

When Git cannot automatically combine two changes to the same region of a file, it leaves conflict markers in the working copy and lets you resolve manually. The markers are not magic; they record exactly what each side did relative to a common base.

By admin , 28 April 2026

Introduction

git push uploads commits to a remote and updates that remote's refs. Unlike fetch, it modifies state on the server, so safety mechanisms exist to prevent overwriting other people's work.

By admin , 28 April 2026

Introduction

git pull is sugar for git fetch followed by integration of the upstream branch into the current branch. The integration step is either a merge (default) or a rebase.

The two steps

  1. git fetch <remote> <refspec>: download and update tracking refs.
  2. If pull.rebase is false: git merge FETCH_HEAD.
  3. If pull.rebase is true: git rebase FETCH_HEAD.

Equivalent manual sequence:

By admin , 28 April 2026

Introduction

git fetch is the network operation that downloads new objects and updates remote-tracking refs. It does not change your branches or working tree, which makes it the safest "what's new?" command.

By admin , 28 April 2026

Introduction

git clone looks like one operation but actually composes several. Understanding the steps helps when troubleshooting partial clones, slow clones, or surprising defaults.

By admin , 28 April 2026

Introduction

Git supports two kinds of tags: lightweight, which are just refs pointing at commits, and annotated, which are full Git objects with metadata. Use annotated tags for releases.

By admin , 28 April 2026

Introduction

Git keeps several special "auxiliary" refs in .git/ to record state during multi-step operations. Knowing them turns scary recoveries into one-liners.

ORIG_HEAD

ORIG_HEAD is set whenever a "dangerous" operation moves HEAD by a lot: merge, rebase, reset, am. It captures the previous tip so you can undo:

git merge feature
# decide it was a mistake
git reset --hard ORIG_HEAD

Same trick after a bad rebase or reset:

By admin , 28 April 2026

Introduction

Git stores objects in two formats: loose (one file per object under .git/objects/xx/yyyy...) and packed (many objects in a single .pack file with a companion .idx). Packs are far more efficient on disk and on the wire.

By admin , 28 April 2026

Introduction

A Git commit references zero, one, or several parent commits. The whole history is a directed acyclic graph (DAG) of these parent links. Branches and tags are simply labels on nodes of this graph.

Anatomy of a parent link

git cat-file -p HEAD
# tree 9f1a...
# parent b2c3...
# parent d4e5...        (only on merge commits)
# author Ada ...
# committer Ada ...

One parent: linear history. Two parents: a merge. Zero parents: a root commit. Three or more: an octopus merge.