Skip to content
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

FR: jj bookmark untrack should delete the local bookmark #5524

Open
scott2000 opened this issue Jan 30, 2025 · 4 comments · May be fixed by #5546 or #5621
Open

FR: jj bookmark untrack should delete the local bookmark #5524

scott2000 opened this issue Jan 30, 2025 · 4 comments · May be fixed by #5546 or #5621
Labels
polish🪒🐃 Make existing features more convenient and more consistent

Comments

@scott2000
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Sometimes I want to work on a remote bookmark, so I run jj bookmark track name@remote, and then I make some changes and push them, and then I want to stop tracking the bookmark since I'm done working on it, so I run jj bookmark untrack name@remote. I would expect untrack to do the opposite of track (meaning it deletes the local bookmark that track created), but currently it doesn't do this, so I have to run jj bookmark delete name afterwards.

Describe the solution you'd like
When a remote bookmark is untracked by jj bookmark untrack and it was the last tracked remote bookmark with that name (to handle the case of tracking from multiple remotes), then any local bookmark with that name should be automatically deleted (but nothing should be abandoned). To me, it seems uncommon to want to untrack a remote bookmark while keeping the local bookmark, but there could be a --keep-local flag to keep the local bookmark if this functionality is still desired.

Describe alternatives you've considered
We could continue to require the user to run two commands in this case. We could also keep the default the same, but add a --delete-local flag to jj bookmark untrack instead.

@PhilipMetzger PhilipMetzger added the polish🪒🐃 Make existing features more convenient and more consistent label Jan 30, 2025
@yuja
Copy link
Contributor

yuja commented Jan 31, 2025

I think the desired command would be jj bookmark forget for local bookmarks.

track merges remote bookmarks to local. The reverse operation of track would be something that merges remote -> absent (or remote -> old_local?) diff into local. It might work if there's only one tracking remote and it's synced, but it seems weird that we have to special-case the last tracking remote.

@scott2000
Copy link
Contributor Author

scott2000 commented Jan 31, 2025

I think the desired command would be jj bookmark forget for local bookmarks.

For me, the main downside to jj bookmark forget is that you have to run jj git fetch after it, otherwise your remote bookmarks will be out of sync with the remote. It also seems unintuitive to me that jj bookmark forget has anything to do with which bookmarks are tracked (especially since it takes a local bookmark name as the argument).

Also, I think if you have auto-tracking turned on, jj bookmark forget on a tracking local bookmark would effectively be a no-op if the bookmark was up-to-date, since any bookmarks you forgot would be re-tracked on the next jj git fetch (but I haven't tested that). I guess in that case it's still useful if the remote bookmark is deleted but you want to tell jj not to abandon the commits?

track merges remote bookmarks to local. The reverse operation of track would be something that merges remote -> absent (or remote -> old_local?) diff into local. It might work if there's only one tracking remote and it's synced, but it seems weird that we have to special-case the last tracking remote.

Yeah, that's a good point. It seems like there's not really any way to perfectly reverse the effect of jj bookmark track on the local bookmark due to the A-B+A = A simplification anyway, so maybe it's better not to try.

I still think it would be nice to be able to delete the local bookmark at the same time as I untrack the remote bookmark (without causing the remote information to become out of sync). Maybe a --delete-local-bookmark/-d flag would be good then?

Edit: or maybe jj bookmark forget should just make the corresponding remote bookmarks become untracked? It seems unintuitive to me that there's a way to forget a remote bookmark without running a command that interacts with the remote.

@yuja
Copy link
Contributor

yuja commented Jan 31, 2025

I meant jj bookmark forget --local or something that deletes local bookmark and tracking states. forget means I don't care this bookmark, so it probably make sense that forget --local means I don't care this local bookmark.

@scott2000
Copy link
Contributor Author

I meant jj bookmark forget --local or something that deletes local bookmark and tracking states. forget means I don't care this bookmark, so it probably make sense that forget --local means I don't care this local bookmark.

Ohh I misunderstood, I'm sorry. Yeah, that could be a good solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
polish🪒🐃 Make existing features more convenient and more consistent
Projects
None yet
3 participants