Skip to content

FR: Split based on remote tip to prevent force-pushing branches in review #5881

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
felipemoran opened this issue Mar 5, 2025 · 2 comments

Comments

@felipemoran
Copy link

Hi all, I'm loving to work with jj, my team less so because now lots of PRs are rebased and github doesn't play nicely with that (you can't easily review the diff between your last review and current state, ie incremental reviews and branch changes).

One of the problems I face is accidentally editing the revision at the tip of a branch in review, so what I'd like to have is a way of splitting changes in that revision (even better is the entire branch) into a new revision such that when I jj git push the branch moves forward only.

Image

In the image above we can see that pl has changes the remote doesn't. What I'd want is to move all extra changes to nx (or a new revision, it doesn't matter) and restore pl to what the remote has.

In this case I ended up rebasing pl into the remote tip jj rebase -s pl -d 949d996b, squashing the local pl into nx (jj squash --from 0ddfd3ba --into nx) and fixing all the conflicts, which was easy because there were only a few changes, but that's not always the case.

Aside, I'd also love if there was a way to always ask for confirmation before moving a branch sideways when pushing as a safety check.

Thanks! Awesome work btw!

@felipemoran felipemoran changed the title FR: Split based on remote tip to prevent rebasing branches in review FR: Split based on remote tip to prevent force-pushing branches in review Mar 5, 2025
@scott2000
Copy link
Contributor

I'm not sure if you're already aware of this or if it would be helpful, but if you want to prevent accidentally rewriting commits in a bookmark, you could add the bookmark to immutable_heads() to make the commits immutable. If you want to rewrite the commits sometimes though, this may not be ideal.

@yuja
Copy link
Contributor

yuja commented Mar 5, 2025

Perhaps, this is basically the same feature request as #5818?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants