git樱桃挑选 - 承诺的范围和排除之间的一些 [英] git cherry pick - range of commits and exclude some in between
问题描述
我通常使用下面的git命令来挑选一系列gerrit。不知道如何排除其中的几个gerrit ...可以修改下面的命令,或者在那里我们可以选择一系列gerrit并排除我们想要的..
git cherrypick fromgerritSHA1..togerritSHA1
您可以指定多个范围:
git cherry-pick A..B C..D E..F
甚至是具体的提交:
git cherry-pick ABCDEF
如果你有很多你想排除的提交,它可能更容易做这样的事情(有点像穷人的 git rebase -i $ b
> git log --pretty = oneline A..F | tac> tempfile.txt
<编辑tempfile.txt删除你不想要的提交>
git cherry-pick $(awk'{print $ 1}'tempfile.txt)
编辑:增加了对 tac
日志的建议,因为 git cherry-pick
想要以相反顺序查看提交什么 git log
产生(也可以使用 git log --reverse ...
)。
I normally use the following git command to cherryppick a range of gerrits..no how do I exclude a couple gerrits in between.. can the below command be modified or is there one where we can pick a range of gerrits and exclude the ones we want..
git cherrypick fromgerritSHA1..togerritSHA1
You can specify multiple ranges:
git cherry-pick A..B C..D E..F
or even specific commits:
git cherry-pick A B C D E F
If you have lots of commits you want to exclude, it might be easier to do something like this (sort of like a poor man's git rebase -i
for git cherry-pick
):
git log --pretty=oneline A..F | tac > tempfile.txt
< edit tempfile.txt to remove the commits you don't want >
git cherry-pick $(awk '{print $1}' tempfile.txt)
Edit: Added recommendation to tac
the log, since git cherry-pick
wants to see the commits in the opposite order from what git log
produces (could also use git log --reverse ...
).
这篇关于git樱桃挑选 - 承诺的范围和排除之间的一些的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!