Skip to content

Move changes to a remote revision into a new revision #2400

Answered by martinvonz
jbcdnr asked this question in Q&A
Discussion options

You must be logged in to vote

Since jj 0.10.0, it will try to prevent you from rewriting remote commits. You can configure the set of commits you consider immutable.

There's also an FAQ entry explaining how to recover if you've accidentally modified a non-remote commit.

But for your case, where you modified a remote commit, one way of fixing it is this:

  1. Run jj co main@origin to create a new change on top of the remote branch. You will now have two commits with the same change id (aka divergence)
  2. Run jj restore --from main to copy the state from that commit into your new change
  3. Run jj abandon main since you don't want that version. This will resolve the divergence and move the branch backwards
  4. Run jj branch set main -…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@necauqua
Comment options

@martinvonz
Comment options

@jbcdnr
Comment options

@necauqua
Comment options

Answer selected by jbcdnr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants