-
Notifications
You must be signed in to change notification settings - Fork 35
Discarding old commits
If we do not need to keep the database state from some (probably old) commits then we can discard these commits. In this way we release database space to be used by future commits, decreasing the final database size.
In the example bellow we have 5 commits on a single branch:
(1)-(2)-(3)-(4)-(5)
If we discard commits 1 through 3 with this command:
PRAGMA discard_commits master.1-3
The resulting state will not contain these commits anymore:
(4)-(5)
We can also discard internal commits. If we instead discard commits 2 through 4 using this command:
PRAGMA discard_commits master.2-4
The remaining result will be:
(1)-(5)
When we have sub-branches as in the example bellow:
(5)
/
(1)-(2)-(3)-(4)-(5)
We can not discard commits that are parent of child branches.
In the above example we cannot discard commit 4.
If we discard commits 1 through 3 the result will be:
(5)
/
(4)-(5)
And if we discard just the commit 3 the result will be:
(5)
/
(1)-(2)-(4)-(5)