how to remove a change from a "branch" #7541
-
(yes i know branches aren't actually a thing, but in this case i'm talking about a bookmark pushed to a remote which would show up as a branch) hi, sorry if this comes off as a little drive-by comment (and if i confuse "revision" and "change"), i just wanted to see if i'm doing anything wrong and couldn't find anything in the issues, i currently have a tab open that looks like this 😅 the TLDR; is "how can I maje jujutsu push a bookmark that removes a commit that's already on the remote?" i got into this situation by doing something similar to:
fum@lumi: ~/Downloads
➜ jj git clone co:fumnanya/jj-test
Fetching into new repo in "/Users/fum/Downloads/jj-test"
Nothing changed.
fum@lumi: ~/Downloads took 6s
➜ cd jj-test
fum@lumi: ~/Downloads/jj-test 🥋 plro | (empty) (no description set)
➜ echo 'hi' > one
fum@lumi: ~/Downloads/jj-test 🥋 plro | (no description set)
➜ jj desc -m "one"
Working copy (@) now at: plrovolp 7d98f865 one
Parent commit (@-) : zzzzzzzz 00000000 (empty) (no description set)
fum@lumi: ~/Downloads/jj-test 🥋 plro | one
➜ jj b c main -r@
Created 1 bookmarks pointing to plrovolp 7d98f865 main | one
fum@lumi: ~/Downloads/jj-test 🥋 plro main | one
➜ jj git push
Changes to push to origin:
Add bookmark main to 7d98f8656d58
Warning: The working-copy commit in workspace 'default' became immutable, so a new commit has been created on top of it.
Working copy (@) now at: yqkwvxvn 110df69b (empty) (no description set)
Parent commit (@-) : plrovolp 7d98f865 main | one
fum@lumi: ~/Downloads/jj-test 🥋 yqkw | (empty) (no description set)
➜ jj desc -m "add goodbye"
Working copy (@) now at: yqkwvxvn 40446ea4 (empty) add goodbye
Parent commit (@-) : plrovolp 7d98f865 main | one
fum@lumi: ~/Downloads/jj-test 🥋 yqkw | (empty) add goodbye
➜ echo 'goodbye' >> one
fum@lumi: ~/Downloads/jj-test 🥋 yqkw | add goodbye
➜ jj b c add-goodbye
Warning: Target revision was not specified, defaulting to the working copy (-r@). In the near future it will be required to explicitly specify target revision.
Created 1 bookmarks pointing to yqkwvxvn 98c79f50 add-goodbye | add goodbye
fum@lumi: ~/Downloads/jj-test 🥋 yqkw add-goodbye | add goodbye
➜ jj git push
Changes to push to origin:
Add bookmark add-goodbye to 98c79f506a8e
remote:
remote: Create a new pull request for 'add-goodbye':
remote: https://codeberg.org/fumnanya/jj-test/compare/main...add-goodbye
remote:
fum@lumi: ~/Downloads/jj-test 🥋 yqkw add-goodbye | add goodbye took 3s
➜ jj new
Working copy (@) now at: nqkrlnut 4a73a0e8 (empty) (no description set)
Parent commit (@-) : yqkwvxvn 98c79f50 add-goodbye | add goodbye
fum@lumi: ~/Downloads/jj-test 🥋 nqkr | (empty) (no description set)
➜ jj desc -m "even more goodbye"
Working copy (@) now at: nqkrlnut eebb9b36 (empty) even more goodbye
Parent commit (@-) : yqkwvxvn 98c79f50 add-goodbye | add goodbye
fum@lumi: ~/Downloads/jj-test 🥋 nqkr | (empty) even more goodbye
➜ echo 'aloha' >> one
fum@lumi: ~/Downloads/jj-test 🥋 nqkr | even more goodbye
➜ jj tug
Moved 1 bookmarks to nqkrlnut ee2195c5 add-goodbye* | even more goodbye
fum@lumi: ~/Downloads/jj-test 🥋 nqkr add-goodbye* | even more goodbye
➜ jj git push
Changes to push to origin:
Move forward bookmark add-goodbye from 98c79f506a8e to ee2195c57fad
remote:
remote: Create a new pull request for 'add-goodbye':
remote: https://codeberg.org/fumnanya/jj-test/compare/main...add-goodbye
remote: and now your "branch" on the remote has two commits which show up like this
fum@lumi: ~/Downloads/jj-test 🥋 nqkr add-goodbye | even more goodbye
➜ jj edit @-
Working copy (@) now at: yqkwvxvn 98c79f50 add goodbye
Parent commit (@-) : plrovolp 7d98f865 main | one
Added 0 files, modified 1 files, removed 0 files
fum@lumi: ~/Downloads/jj-test 🥋 yqkw | add goodbye
➜ jj b m add-goodbye --allow-backwards
Warning: Target revision was not specified, defaulting to the working copy (--to=@). In the near future it will be required to explicitly specify it.
Moved 1 bookmarks to yqkwvxvn 98c79f50 add-goodbye* | add goodbye
fum@lumi: ~/Downloads/jj-test 🥋 yqkw add-goodbye* | add goodbye
➜ jj abandon n
Abandoned 1 commits:
nqkrlnut ee2195c5 add-goodbye@origin | even more goodbye
fum@lumi: ~/Downloads/jj-test 🥋 yqkw add-goodbye* | add goodbye
➜ jj git push
Warning: No bookmarks found in the default push revset: remote_bookmarks(remote=origin)..@
Nothing changed. Attempting to push gives an error saying Now I assume that this means "all the commits/changes you're trying to push are already on the remote, so there's nothing to push", but in this case I want it to delete I think with git what I'd do would be an interactive rebase with (Apologies for all the clutter haha, I wanted this question to be easy to follow so I included my shell prompt that says the state of the repo, but even the Q/A bit in Discord told me I was wayyyyy over the character limit) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
(for posterity i should say that the way i dealt with this elsewhere was by rebasing against |
Beta Was this translation helpful? Give feedback.
-
In this scenario, you'd just need to specify the branch to push:
The default push revset does the intended thing in most scenarios, but if a bookmark moved backwards (and not sideways by being amended), it doesn't find any revisions to push because |
Beta Was this translation helpful? Give feedback.
In this scenario, you'd just need to specify the branch to push:
The default push revset does the intended thing in most scenarios, but if a bookmark moved backwards (and not sideways by being amended), it doesn't find any revisions to push because
@
is already on the remote.