在特定的遥控器,分支和提交上的git rebase
The situation is:
I've got a local git repo with no set remotes. I want to add a remote for a specific branch, which a believe I can do like this:
git remote add New_Remote -t -f {New_Remote_Branch} {Repo}
I then want to rebase my local git repo不仅是new_remote_branch
的负责人,而且要涉及它的特定提交。我已经阅读了文档,并且已经看过- 在
选项上,但是我对如何将其定位到特定的遥控器和提交有点困惑。我在测试这个概念并找到语法方面遇到了麻烦。 I believe I'm looking for something like:
(from the local repo directory)
git rebase New_Remote/New_Remote_Branch --onto {New_Remote_Branch_Specific_Commit_id}
The situation is:
I've got a local git repo with no set remotes. I want to add a remote for a specific branch, which a believe I can do like this:
git remote add New_Remote -t -f {New_Remote_Branch} {Repo}
I then want to rebase my local git repo not just to the HEAD of New_Remote_Branch
but to a specific commit of it. I've read the docs and I've seen the --onto
option but I'm a bit confused about how to target it to a specific remote and and commit. I've had trouble testing this concept and finding the syntax. I believe I'm looking for something like:
(from the local repo directory)
git rebase New_Remote/New_Remote_Branch --onto {New_Remote_Branch_Specific_Commit_id}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
git rebase
的完整语法是:它将在old_upstream和branch_to_rebase之间进行所有提交,并在new_upstream上重新创建它们。最后,“ branch_to_rebase” ref将指向重新创建的最新提交。
所有三个参数都可以是分支,标签或提交。最后一个通常应该是分支,否则您最终会以脱离的头状态(但很容易恢复)。前两个论点只需要解决提交。
,在您的情况下,您的命令看起来像:
因此
The full syntax of
git rebase
is:It will take all commits between old_upstream and branch_to_rebase and recreate them on top of new_upstream. In the end, the "branch_to_rebase" ref will point to the newest of the recreated commits.
All three arguments can be a branch, tag, or commit. The last one should usually be a branch, otherwise you end up in detached HEAD state (but it's easy to recover). The first two arguments only need to resolve to a commit.
So in your case, your command will look something like:
(assuming that you want to copy all commits on your branch that were created since master)