git:如何将某个作者的所有提交重新设置为一个单独的分支? [英] git: How to rebase all commits by one certain author into a separate branch?

查看:333
本文介绍了git:如何将某个作者的所有提交重新设置为一个单独的分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一些没有使用SCM的代码 + ,并以所有项目文件的形式接收偶尔的更新,尽管其中只有一些更改了一点。到目前为止,我只是把自己的修改放到了一个git仓库中,然后用一个手动的 git add -p session来解决这些更新问题,这个会话越来越讨厌这个数量我自己的变化(那些不确定要发布的变化)增加,并且幸运的是,我为前面提到的补丁做了 git commit --authorothers,我想知道:
$ b


一个作者所做的所有提交如何分解为一个新的分支?


(我不介意在这种情况下重写历史记录,回购仅用于我)



理想的解决方案将包括在每个补丁之后将其他人的分支合并到我的分支中,但现在最终的最终合并可能就足够了。




+ 是的,Jedi 确实感觉到了你的不满

解决方案

我最近为某人做过这件事:

  git checkout -b other_工作< sha1_of_where_to_rebase> 
git log --reverse --author = others --format =%H< sha1_range> | xargs -n 1 git cherry-pick

希望这会有所帮助


I'm using some code for which no SCM is used+ and receive occasional updates in the form of all project files although only some of them have been changed only a bit. Up till now I just put my own changes in a git repo and solved these "updates" with a manual git add -p session which is getting more and more annoying with the amount of my own changes (those that are not determined to be published yet) increasing, and since luckily I did git commit --author "the others" for aforementioned "patches", I'd like to know:

How can all commits made by one author be separated into a new branch?

(I don't mind rewriting history in this case, the repo is only used by me)

The ideal solution would include a merge of the others' branch into mine after every "patch", but for now a final merge at the end may suffice.


+ yes, the Jedi did feel you cringe there

解决方案

I recently did this for someone:

git checkout -b other_work <sha1_of_where_to_rebase>
git log --reverse --author=others --format=%H <sha1_range> | xargs -n 1 git cherry-pick

Hope this helps

这篇关于git:如何将某个作者的所有提交重新设置为一个单独的分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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