Skip to content

Editing Commits

Bernardo Ramos edited this page Nov 29, 2018 · 2 revisions

We can edit the SQL commands used to generate a commit.

This is useful for conflict resolution before merging or rebasing branches.

The whole process is atomic, even when modifying many commits at once.

Editing a single commit

Setting all the commands for a given commit:

pragma branch_log --set {commit} {commands}

Adding new commands to a commit:

pragma branch_log --add {commit} {commands}

Deleting commands from a commit:

pragma branch_log --del {commit} {command_list}

Where commands are formatted as either:

  • separated by ;
  • in netstring format

And command_list is a list of command ids (position based, base 1) separated by commas

Examples

Setting these 2 SQL commands as the generators of commit 12 at the master branch:

pragma branch_log --set master.12 INSERT INTO t1 VALUES ('test');UPDATE t2 SET active=0
pragma branch_log --set master.12 30:INSERT INTO t1 VALUES ('test'),22:UPDATE t2 SET active=0,

Adding these 2 commands to the commit 12 at the master branch:

pragma branch_log --add master.12 INSERT INTO t1 VALUES ('test');UPDATE t2 SET active=0
pragma branch_log --add master.12 30:INSERT INTO t1 VALUES ('test'),22:UPDATE t2 SET active=0,

Deleting commands 2 and 4 from commit 15 at the master branch:

pragma branch_log --del master.15 2,4

Editing many commits at once

This can be used to implement an interactive rebase

In this case the commands need to be formatted as netstrings:

pragma branch_log --set master.12 {netstr} master.13 {netstr} master.14 {netstr} ...
Clone this wiki locally