Undo Flexlate Operations

Flexlate commits to branches as it makes changes, so reversing changes is not as simple as resetting the working directory.

There are two ways to undo a Flexlate operation: via fxt undo or by deleting the Flexlate feature branches.

Undo Operations with fxt undo

Think of fxt undo as CTRL/CMD + Z for Flexlate. It reverses the Git history to undo the last transaction. Flexlate puts transaction markers in all its commit messages, and it will only undo commits with a marker or merging a commit with a marker.

Warning

Flexlate has multiple protections in place to avoid deleting your changes, but it still deletes Git history. It is recommended to only use this command if you are following a feature branch workflow.

    $ fxt add output copier-simple-example
 Applying template copier-simple-example to /tmp/tmplhfe88i8
 Updating 1 applied templates

question1? Format: yaml
my answer

The second question
question2? Format: float
10

    create  my answer.txt



    create  temp.txt


✔ Successfully updated template output
✔ Successfully applied template copier-simple-example to /tmp/tmplhfe88i8

$ ls
 flexlate-project.json	 flexlate.json	'my answer.txt'   woo.txt

$ fxt undo
 Undoing transaction 1
  Undoing 1 flexlate transactions
  Undoing 1 flexlate transactions
  Undoing 1 flexlate transactions
✔ Successfully reversed transaction 1
  Undoing 1 flexlate transactions
  Undoing 1 flexlate transactions


$ ls
flexlate-project.json  flexlate.json  woo.txt

Undo Operations by Deleting Feature Branches

Flexlate saves the history of your operations on the Flexlate feature branches
that need to be merged into the main branches to permanently save. If you have not yet merged the feature branches into the main branches, and you want to reverse all operations you’ve made on this feature branch, you can simply delete the Flexlate feature branches.

    $ git checkout -b my-feature
Switched to a new branch 'my-feature'

$ fxt add output copier-simple-example
 Applying template copier-simple-example to /tmp/tmp8y1imk9e
 Updating 1 applied templates

question1? Format: yaml
my answer

The second question
question2? Format: float
10

    create  my answer.txt



    create  temp.txt


✔ Successfully updated template output
✔ Successfully applied template copier-simple-example to /tmp/tmp8y1imk9e

$ ls
 flexlate-project.json	 flexlate.json	'my answer.txt'   woo.txt

$ git checkout main
Switched to branch 'main'

$ git branch -D my-feature
Deleted branch my-feature (was 8df230c).

$ git branch -D flexlate-templates-my-feature
Deleted branch flexlate-templates-my-feature (was 8df230c).

$ git branch -D flexlate-output-my-feature
Deleted branch flexlate-output-my-feature (was 8df230c).

$ ls
flexlate-project.json  flexlate.json  woo.txt