Git internals

Git OFS_DELTA offset

Encode a positive pack-file backward distance using Git’s biased offset format.

Your inputs

Start with an example

Your inputs stay in your browser.

Your result

Example result

How it works

Store the low seven bits, shift right seven, subtract one before encoding each additional group, and mark all nonfinal groups with bit 7.

Distance 128 encodes as 80 00, unlike MIDI VLQ 81 00.

Limits

Offset bytes only, not a pack entry or delta instruction stream. Distances are limited to positive signed-64-bit range.