简体   繁体   English

git rebase -ia分支到自己

[英]git rebase -i a branch onto itself

I had the following in my repo 我的回购中有以下内容

Master---
     \
       Next-->Commit A.1,Commit A.2,Commit A.3 --......

I want to fix-up the A.* commits into one commit describing the feature A. I tried git rebase -i origin next , but that didn't work how I expected. 我想将A. *提交修复为一个描述特征A的提交。我git rebase -i origin next尝试了git rebase -i origin next ,但是这没有按照我的预期工作。 Is there any way of accomplishing this? 有没有办法实现这个?

I thought of creating a branch foo, which is essentially next, and then rebase next onto foo followed by merge/delete foo. 我想创建一个分支foo,它本质上是下一个,然后在foo下面重新绑定到merge / delete foo。 However, this seems sloppy. 但是,这似乎很草率。

You just need to do: 你只需要这样做:

git rebase -i <COMMIT-ISH>

... where <COMMIT-ISH> is some way of referring to the commit marked Master in your diagram. ...其中<COMMIT-ISH>是一种引用图中标记为Master的提交的方法。 If there's a branch pointing to that point (probably master or origin/master ) then git log --decorate will show that. 如果有一个分支指向该点(可能是masterorigin/master ),那么git log --decorate将显示该git log --decorate

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM