pijul_org / pijul

#367 Checkout after fork not possible

Opened by porky11, on March 16, 2019
Open
porky11 commented on March 16, 2019

When I did a fork, while having not a clean working tree, it's not possible to checkout back to the forked branch, even if all recorded files are the same. It would be nice to have. An use case would be, when you accidentally created a new branch and then recognize, you still didn't commit your last changes before. Then going back should be as simple as in git.

It would be even better, that checkout also works, if the current set of patches is different for both branches, as long as the local changes don't cause any conflict between these branches. I just had the case, where I worked on some library, which has multiple files. I'll call them "utils" and "library". So I though, "utils" was finished, so I recorded everything and started working on "library". Then I recognized, I miss a few utils to implement "library", but I already did a bunch of changes to library. So I continued working on "utils", not knowing I would not be able to work on "library" again for some time, (and recorded the chages made on "utils" a few times). Then I made some experimental changes to "utils", which I didn't want to record into the current branch, so I did a fork. Now the fork contains both, the initial work on "library" and the experimental changes to "utils". So after I record the experimental changes of "utils" to my new branch, but I can't go back to the main branch without either reverting or recording my unfinished work on "library". I'd just want to go back to the main branch, so I could either not worry about my local changes at all or simply make a new branch from there to make a temporary record of these changes until I continue working. But instead, assuming I just want to have my local changes back on the main branch, I have to record it on the wrong branch, go to main branch, merge only this change from that branch, go back to that branch unrecord and revert, go back to main branch, unrecord again, but not revert, when I want to have it locally again.

FlorentBecker commented on May 14, 2019

checkout should probably silently save unrecorded changes if any in a branch-specific "draft patch" and restore them when going back to that branch.