我如何使用'git rebase -i'重新设置分支中的所有更改? [英] How do I use 'git rebase -i' to rebase all changes in a branch?

查看:928
本文介绍了我如何使用'git rebase -i'重新设置分支中的所有更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是一个例子:

Here's an example:

>git status
# On branch master
nothing to commit (working directory clean)
>git checkout -b test-branch
>vi test.c
>git add test.c
>git commit -m "modified test.c"
>vi README
>git add README
>git commit -m "modified README"

现在我想做一个' git rebase -i ',这将允许我重定义此分支的所有提交。有没有像' git rebase -i HEAD〜MASTER '或类似的东西。我想我可以做' git rebase -i HEAD〜2 ',但我真的不想要计算已经做了多少次提交。我也可以做' git rebase -i sha1 ',但我不想通过git log查找第一个提交sha1。任何想法?

Now I want to do a 'git rebase -i' that will let me rebase all commits for this branch. Is there something like 'git rebase -i HEAD~MASTER' or similar. I figure I could do 'git rebase -i HEAD~2', but I really don't want to have to count how many commits have been made. I could also do 'git rebase -i sha1' but I don't want to comb through git log to find the first commit sha1. Any ideas?

推荐答案

您是否尝试过: git rebase -i master

这篇关于我如何使用'git rebase -i'重新设置分支中的所有更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆