可以为单个本地分支上的每个提交创建单独的拉取请求吗?

huangapple go评论44阅读模式
英文:

Is it possible to create a separate pull requests for each commit on a single local branch?

问题

我曾经在一个专门的工具上工作,用于提交拉取请求,该工具是建立在git之上的。实际上,这是我创建拉取请求的唯一经验。

这个工具为本地分支上的每个不同提交创建了一个拉取请求。

我现在正在处理一个不同的代码库,必须使用git的原生功能,我想知道是否有办法使用原生功能来实现这种能力?

例如,对于我的本地feature_branch,我有commit1, commit2, commit3。我想创建与每个提交对应的3个拉取请求,并且这些拉取请求按顺序叠放在一起。

根据我简要的搜索,似乎我需要为每个提交创建一个单独的本地分支,将每个本地分支推送到远程,然后从每个远程分支创建一个拉取请求。我不确定在这种情况下如何进行叠放。

英文:

I used to work on a codebase with a specialized tool for submitting pull requests that's built on top of git. In fact, it's the only experience I have with creating pull requests.

This tool created a pull request for each distinct commit on a local branch.

I'm now working on a separate codebase and have to use git's native features, and I'm wondering if there's a way to reproduce this capability with the native capabilities?

For example, on my local feature_branch, I have commit1, commit2, commit3. I would like to create 3 pull requests corresponding to each commit and these pull requests are stacked on top of each other.

Based on my brief searches, it seems I'd have to create a separate local branch for each commit, push each local branch to remote, and create a pull request from each remote branch. I'm not sure how the stacking works in this case.

答案1

得分: 2

"native capabilities"?
不是来自git本身。
但GitHub有一个名为CLI gh的工具,其中包括gh pr create命令,您可以使用它来模拟创建PR的情境,结合git switch -c newBranch
GitHub甚至有现在的合并队列

英文:

"native capabilities"?

Not from git itself.

But GitHub has a CLI gh, with a gh pr create command which you can use to emaulte your PR creation scenario, combined with git switch -c newBranch.

And GitHub even has merges train now.

huangapple
  • 本文由 发表于 2023年2月9日 02:41:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/75390353.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定