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

Add a way to push all branches that have a remote branch #191

Open
Gelio opened this issue Mar 2, 2022 · 5 comments
Open

Add a way to push all branches that have a remote branch #191

Gelio opened this issue Mar 2, 2022 · 5 comments
Labels
enhancement Improve the expected

Comments

@Gelio
Copy link

Gelio commented Mar 2, 2022

Hey! I'm opening an issue to capture the functionality discussed in https://github.com/epage/git-stack/discussions/189#discussioncomment-2276150 that would allow git stack --push to push all branches that already have a corresponding remote branch, even if they are not considered ready.

That would help when working with stacked PRs, since I would be able to push all branches on my branches stack with a single command. At the moment, only the first branch from the stack is pushed, since that is the only one that is considered ready. Other branches are not ready, because their parent branch (the previous branch on the stack) is not merged into the protected branch yet.

To make this work, we would probably need another configuration option/flag. If enabled, git stack --push would override the existing ready check and instead treat a branch as ready if:

  1. it has no WIP commits (probably)
  2. there is a remote branch with the same name

Question to answer: for the 2nd condition, what if the local branch is named differently than the remote tracking branch? This could happen if the user manually set the remote tracking branch.
git stack --push would push to the branch under the same name anyway, ignoring the remote-tracking branch, so it seems like a tangential issue that can be handled separately. A quick note is that I believe we could use the @{push} revision to push to the remote branch according to the user's push.default and other config options.

@pietvanzoen
Copy link

+1 this request.

I don't like leaving a lot of work locally on my machine without a remote backup so I tend to git push --force-with-lease all my stacked branches while they're in progress.

@arxanas
Copy link
Contributor

arxanas commented Sep 17, 2022

By chance, I recently added this functionality to git-branchless in arxanas/git-branchless#541. It introduces a git submit command which force-pushes all branches which have a remote in the current stack (or selected commits), and with --create, will push any local branches which don't have remote branches.

There's still some UI work that needs to be done for deciding when to create branches, but I think git-stack users weren't expecting the command to create branches for them anyways.

@epage
Copy link
Collaborator

epage commented Sep 18, 2022

From the original discussion

https://github.com/epage/git-stack/pull/190 will help. I want to have the "push whats already pushed" but there will be a little more work to make sure I get the logic right. Mind opening an issue about that so we can make sure we continue to track it?

Wish I had written down what this was

I don't like leaving a lot of work locally on my machine without a remote backup so I tend to git push --force-with-lease all my stacked branches while they're in progress.

Note that, at it stands, this issue would only help once you've pushed and not for new branches. You'd still need to manually push.

https://github.com/epage/git-stack/pull/190 will help. I want to have the "push whats already pushed" but there will be a little more work to make sure I get the logic right. Mind opening an issue about that so we can make sure we continue to track it?

Wish I knew what I was referring to here.

By chance, I recently added this functionality to git-branchless in arxanas/git-branchless#541. It introduces a git submit command which force-pushes all branches which have a remote in the current stack (or selected commits), and with --create, will push any local branches which don't have remote branches.

It would be a help for me in following what you all are doing and seeing how we can cross-pollinate ideas if more details were put in the PR.

@arxanas
Copy link
Contributor

arxanas commented Sep 24, 2022

@epage posted discussion here arxanas/git-branchless#564

@allista
Copy link

allista commented Oct 18, 2023

+1 to this request

A pity it is suspended for more than a year now 😞

Alas, I'm not a rust guy to help quickly.

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

No branches or pull requests

5 participants