Run Commands

Squash Non-Head Commits

Learn how to squash commits that are not the HEAD of a branch.

May 30, 2023

If your commit has children, you have the option to use the squash commit command. Squashing is a way to rewrite your commit history; this helps clean up and simplify your commit history before sharing your work with team members.

Squashing a commit in Pachyderm means that you are combining all the file changes in the commits of a global commit into their children and then removing the global commit. This behavior is inspired by the squash option in git rebase. No data stored in PFS is removed since they remain in the child commits.

pachctl squash commit <commit-ID>

Example #

In the simple example below, we create three successive commits on the master branch of a repo repo:

We then run pachctl squash commit ID1, then pachctl squash commit ID2, and look at our branch and remaining commit(s).

Squash example

At any moment, pachctl list file repo@master invariably returns the same files Aā€™, B, Cā€™. pachctl list commit however, differs in each case, since, by squashing commits, we have deleted them from the branch.

Considerations #

Limitations #