简体   繁体   English

Git rebase 选择当前分支的提交

[英]Git rebase with a selection of current branch's commits

I want to clean up my git commit on a branch, named theme , but with my last rebase from master, I messed up on the git commits log (it's out of order).我想清理我在名为theme的分支上的 git 提交,但是在我最后一次从 master 变基时,我搞砸了 git 提交日志(它是乱序的)。 Here's an example of my current situation and what I'm trying to do:这是我目前的情况和我正在尝试做的一个例子:

In my theme branch, I have commits ranging from J1-Z1 (hashes)在我的主题分支中,我的提交范围从 J1-Z1(哈希)
In my master branch, I have commits from AZ在我的分支中,我有来自 AZ 的提交

I want to clean up my theme branch commits so that I have all of master's commit (AZ) along with a group of theme branch commits (lets say M1-Z1) ontop, so it would look like AZ,M1-Z1.我想清理我的主题分支提交,以便我拥有所有主提交(AZ)以及一组主题分支提交(比如说 M1-Z1),所以它看起来像 AZ,M1-Z1。 That means any other commits before M1 would be discarded.这意味着 M1 之前的任何其他提交都将被丢弃。

How would I go about doing this?我将如何 go 这样做?

I ended up making a new branch from master and cherry-picking the selection of commits from theme branch.我最终从 master 创建了一个新分支,并从主题分支中挑选了提交的选择。

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

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