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: Git push-to-branch #3588

Open
Cretezy opened this issue Apr 28, 2024 · 2 comments
Open

FR: Git push-to-branch #3588

Cretezy opened this issue Apr 28, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@Cretezy
Copy link
Contributor

Cretezy commented Apr 28, 2024

Is your feature request related to a problem? Please describe.

When pushing to a git remote, 2 operations must happen:

  1. jj branch set <branches> -r <revision> (and optionally create until FR: Upsert branch (update branch or create if it does not exist) #3584 lands)
  2. jj git push

Describe the solution you'd like

git push-to-branch <branches> -r <revision> which would push branches to the remote.

This would behave similarly to jj branch set (possibly with --allow-backwards) and jj git push (although would only push the related branches/revision).

Potential options:

  • --revision/-r
  • --allow-backwards/-B
  • --remote

How it would look

# Start new change
jj fetch
jj new main@origin
# Do changes, commit
jj commit
# Push it up!
jj git push-to-branch my-cool-change -r @-
# Make more changes. Can either be a new commit after, or squashed into previous commit
jj commit / jj squash
# Update the remote branch with our changes (however they were recorded)
jj git push-to-branch my-cool-change -r @-

Open questions

  1. Should this command create local branches or remote-only?
@PhilipMetzger PhilipMetzger added the enhancement New feature or request label Apr 28, 2024
@khionu
Copy link
Contributor

khionu commented Apr 29, 2024

I'm not a fan of this. Doing VCS operations and pushing them at the same time feels like a large footgun. With branch auto advancing, the "commit, branch set, push" flow is already getting reduced from 3 to 2 steps.

@yuja
Copy link
Contributor

yuja commented Apr 29, 2024

#2098 (comment) might be related. It adds a command to push commits to the specified remote ref (without creating a local ref.)

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

No branches or pull requests

4 participants