git:如何将某个作者的所有提交重新设置到一个单独的分支中?

| 我正在使用一些未使用SCM的代码,并且偶尔会以所有项目文件的形式接收更新,尽管仅对其中的一部分进行了少许更改。到目前为止,我只是将自己的更改放入git repo中,并通过手动
git add -p
会话解决了这些“更新”,这对于我自己的更改量(那些尚未确定要发布的更改)变得越来越烦人)的增加,而且很幸运,由于我为上述\“补丁\”做了$ 1,所以我想知道:   如何将一个作者的所有提交分成一个新的分支? (在这种情况下,我不介意重写历史记录,该仓库仅由我使用) 理想的解决方案是在每个“补丁”之后将其他分支合并到我的分支中,但是目前最后一次最终合并可能就足够了。 +是的,绝地确实感觉到你在那儿畏缩     
已邀请:
我最近为某人这样做:
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
希望这可以帮助     
我不太了解自己在做什么,但是您使用第三方代码库描述的问题称为“供应商分支”。这是我的处理方式: 为第三方版本建立分支,例如
vendor
我假设您的分支称为
master
。当他们发布新版本时,您可以执行以下操作:
git stash # If you have any uncommitted files
git checkout vendor
tar -xzvf [new files]  # This might be unzip or whatever, rather than tar
git commit -am \"Version xxx from upstream\"  # Adjust commit message to suit
git checkout master
git merge vendor   # Bring changes into your branch (you could use rebase here if you prefer to keep all your changes on top of all their changes)
git stash pop # Restore your uncommitted files
ps。而不是
git add -p
,我会使用
git gui
。我对使用gui表示怀疑,但是现在没有without7ѭ和
gitk
(或者在Mac上为
gitx
),我无法生存。     

要回复问题请先登录注册