Git交互式底座不承诺挑选 [英] Git interactive rebase no commits to pick

查看:78
本文介绍了Git交互式底座不承诺挑选的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是主人,我做了 rebase -i< my_branch>



明白了:

  noop 

#将c947bec..7e259d3重新登录到c947bec

#命令:
#p,pick =使用提交
#r,reword =使用提交,但编辑提交消息
#e,edit =使用提交,但停止修改
#s,squash =使用提交,但是融合到之前的提交中
#f,fixup = likesquash,但放弃此提交的日志消息
#x ,exec< cmd> =运行一个shell命令< cmd>,如果失败则停止

#如果你在这里删除一行,那么这个COMMIT将会丢失。
#但是,如果您删除了所有内容,rebase将会中止。

我想挑选一些不是全部的提交,因为其中一些提交不受欢迎。
当你想保留一些文件或者更改总是本地到某个分支时,你又如何工作?有没有像 .gitignore

解决方案

如果你提供了一个当前提交的直接祖先,那么你不会改变任何事情;使用交互式底图,即使提交是当前提交的直接祖先,但您必须指定要从之后编辑的提交,您可以在提交之后编辑提交。



我不知道你的情况的细节,但你可能想要这样的东西:

 #编辑或修剪原始/主控和当前分支之间的提交的机会
git rebase -i原点/主控



 #编辑最近10次提交中的一些
git rebase -i HEAD〜10 #注意~10使用波浪号(〜)而不是短划线( - _)!


I'm on master and I did rebase -i <my_branch>

Got this:

noop

# Rebase c947bec..7e259d3 onto c947bec
#
# Commands:
#  p, pick = use commit
#  r, reword = use commit, but edit the commit message
#  e, edit = use commit, but stop for amending
#  s, squash = use commit, but meld into previous commit
#  f, fixup = like "squash", but discard this commit's log message
#  x <cmd>, exec <cmd> = Run a shell command <cmd>, and stop if it fails
#
# If you remove a line here THAT COMMIT WILL BE LOST.
# However, if you remove everything, the rebase will be aborted.
#

I would like to pick some commits not all as some of them are not welcome. Also how do you work when you want to keep some files or changes always 'local' to some branch? Is there some helper like .gitignore?

解决方案

Like a non-interactive rebase, you have to rebase onto a particular commit.

With a non-interactive rebase, if you supply a direct ancestor of the current commit then you aren't changing anything; with an interactive rebase you can edit commits after the commit that you are rebasing onto, even if the commit is a direct ancestor of your current commit but you do have to specify this commit that you want to edit onwards from.

I don't know the details of your situation but you might want something like this:

# Opportunity to edit or prune commits between origin/master and current branch
git rebase -i origin/master

or

# Edit some of the last ten commits
git rebase -i HEAD~10 # Note that ~10 uses a tilde("~") not a dash("-"_) !

这篇关于Git交互式底座不承诺挑选的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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