# Modify change that has dependencies

**URL:** <https://discourse.pijul.org/t/modify-change-that-has-dependencies/1189>\
**Category:** Question\
**Created:** [April 14, 2024, 4:18pm UTC](https://discourse.pijul.org/t/modify-change-that-has-dependencies/1189 "2024-04-14T16:18:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sergey](https://avatars.discourse-cdn.com/v4/letter/s/9fc348/32.png) [@sergey](https://discourse.pijul.org/u/sergey)\
**Post date:** [April 14, 2024, 4:18pm UTC](https://discourse.pijul.org/t/modify-change-that-has-dependencies/1189/1 "2024-04-14T16:18:38Z")

</div>

Hi!

I found the approach of Pijul interesting, and I started experimenting with it. Sorry if my question is not very wise, but how is it possible to rewrite some change in history that has dependent changes?

My experimental use case is:

I have a bunch of projects, most of them have a shared codebase. I want to organize them as a monorepo with different channels to avoid repeating myself.

I have the following imagine history:

```auto
A -> B -> C -> D (main)
       -> E -> F (channel)

```

I want to change B change (e.g., fix a minor bug or change dependency versions in Cargo.yaml, etc.), but I want to keep all other changes (C, D, E, F).

Is it possible to achieve this with Pijul? If yes, how can it be done?

Thanks in advice 🙂

---

<div class="post-metadata">

**Author:** ![pmeunier](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/pmeunier/32/4_2.png) [@pmeunier](https://discourse.pijul.org/u/pmeunier)\
**Post date:** [April 14, 2024, 4:38pm UTC](https://discourse.pijul.org/t/modify-change-that-has-dependencies/1189/2 "2024-04-14T16:38:44Z")

</div>

Hi! Welcome here.

This isn’t yet possible, but I’ve been working on things like this recently, I would hope this will finally come before the end of this year.

Some things that “sound easy” for other version control systems, like rewriting history, are sometimes much much harder to implement in Pijul than in others. Some things are also many times easier, like commutative patches.

---

<div class="post-metadata">

**Author:** ![sergey](https://avatars.discourse-cdn.com/v4/letter/s/9fc348/32.png) [@sergey](https://discourse.pijul.org/u/sergey)\
**Post date:** [April 17, 2024, 3:19pm UTC](https://discourse.pijul.org/t/modify-change-that-has-dependencies/1189/3 "2024-04-17T15:19:13Z")

</div>

Nice to hear that! Thanks for the reply

---

<div class="post-metadata">

**Author:** ![pcarbonn](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/pcarbonn/32/600_2.png) [@pcarbonn](https://discourse.pijul.org/u/pcarbonn)\
**Post date:** [April 18, 2024, 4:28pm UTC](https://discourse.pijul.org/t/modify-change-that-has-dependencies/1189/4 "2024-04-18T16:28:20Z")

</div>

Just curious: why would you want to change B, instead of creating a change G and adding it to both channels? That would seem more logical to me. The notion of history is less important in pijul than in git, the way I see it.

---

<div class="post-metadata">

**Author:** ![ryanbooker](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/ryanbooker/32/561_2.png) [@ryanbooker](https://discourse.pijul.org/u/ryanbooker)\
**Post date:** [May 7, 2024, 8:18am UTC](https://discourse.pijul.org/t/modify-change-that-has-dependencies/1189/5 "2024-05-07T08:18:07Z")

</div>

One simple example I can think of: You accidentally check in a secret key and don’t notice for a while. Once you realise, you want to remove it from the history.

Sometimes errors like that happen and it’s often insufficient to remove it in a patch. You want to scrub all trace of it from the history without having to unrecorded and attempt to rerecord every dependent change.

---

<div class="post-metadata">

**Author:** ![ony](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/ony/32/679_2.png) [@ony](https://discourse.pijul.org/u/ony)\
**Post date:** [June 20, 2026, 7:09pm UTC](https://discourse.pijul.org/t/modify-change-that-has-dependencies/1189/6 "2026-06-20T19:09:06Z")

</div>

I thought I could do `pijul fork --state B rewrite` , then modify on `rewrite` that change I want, and then re-apply rest of the patches.

But right after fork shows diff of file was deleted and re-created. Minimal example:

```bash
pijul init && pijul add .ignore && pijul record --all -m import
state=$(pijul log --state --limit 1 --output-format json | jq -r '.[].state')
echo .mypy_cache >> .ignore
echo Hi > x.txt
pijul add x.txt && pijul record --all -m next
pijul diff # notice empty output
pijul fork --state "$state" rewrite
pijul diff # notice x.txt shown both as "File deletion" and "File addition" - weird

```

Attempt to continue didn’t work either

```bash
next_hash=$(pijul log --limit 1 --output-format json | jq -r '.[].hash')
pijul channel switch --force rewrite # drop that weird diff and switch anyway
pijul record --amend --all -m init # fix message from "import" to "init"
echo target >> .ignore # just to make application harder
pijul record --all --amend
pijul apply $next_hash
pijul log # shows that old "import" change was brought in additionally to amended
pijul diff # shows deletion of both x.txt and .ignore for some reason but both are in workspace unaffected

```

Only after `pijul reset --force` I see expected state. E.g. additional version of `.ignore` that I assume and indication of conflict I was expecting (also visible as move).

From this experiment I understand that Pijul:

- Can only amend/unrecord tip records
- My assumption that I can cherry-pick records and insert records in between “unrelated” evolutions was wrong. We always apply whole sub-graph with all dependencies and no way to remove (“rebase”) dependency.
- Seems like resolving conflicts happens on top rather than on bottom of conflicting changes.

P.S. I’m new to Pijul. Expect nonsense.
