Question

I have two repos, dev and testing. In dev, I've made several commits since the last push to testing. However, now I want to shelve all those commits, make a different change, push it to testing, and then get those commits back. Shelving only works on uncommitted files.

What should I do? Backout or rollback or revert each commit in reverse order? Rename dev, clone testing to dev, make changes, push to testing, push to renamed dev, delete dev, rename renamed dev back to dev?

What's the cleanest/easiest way to do this?

Was it helpful?

Solution

For clarity to other readers: the actual HG shelve command is not the correct approach for this situation; it does not work on already-committed changes, but nor is it necessary to use in this case.

Here's what you can do:

  1. In dev, update to the version before the commits you don't want to push to testing.
  2. Make your desired changes in dev and commit. This will create a new head (which will also be the new tip).
  3. Push to testing
  4. In dev, merge the tip with the other head that contains the changes you have avoided pushing, then commit.

Original suggestion (not possible to implement in this case):

  1. Clone dev into a new repo and update to the version before the commits (or just clone testing instead)
  2. Make the change you want, commit and push to both testing and dev
  3. Discard the clone
  4. Pull the testing from testing into dev and merge the heads at your leisure, establishing a single head once more

OTHER TIPS

Another workflow may be: Use MQ extension

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top