恢复特定作者自特定时间以来的所有提交 [英] Revert all commits by a specific author since specific time
本文介绍了恢复特定作者自特定时间以来的所有提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从4天前恢复特定作者的所有提交。我可以用这个:
为了得到所有sha1s(带点噪音) pre> git log --author = Mohsen --pretty = one --since = 4.days
解决方案
您必须将格式:%H
改为 git log
并使用循环:
用于`git log中的sha --pretty = format:%H - -author = Mohsen --since = 4.days`; do
git revert --no-edit $ sha
done
这会每个还原创建一个提交。抑制 - no-edit
选项以交互方式修改每次还原中的提交消息。
或者,如果您想要做一个大的恢复提交:
for g in git log --pretty = format:%H`; do sharange =$ sharange $ sha;完成
git revert $ sharange --no-commit
git commit -m还原提交$ sharange
I want to revert all commits by a specific author since 4 days ago. How do I do it?
To get all sha1s (with a bit of noise) I can use this:
git log --author=Mohsen --pretty=one --since=4.days
解决方案
You have to give format:%H
to git log
and use a loop:
for sha in `git log --pretty=format:%H --author=Mohsen --since=4.days`; do
git revert --no-edit $sha
done
This will create one commit per revert. Suppress the --no-edit
option to modify interactively the commit message on each revert.
Or, if you want to make one big revert commit:
for sha in `git log --pretty=format:%H`; do sharange="$sharange $sha"; done
git revert $sharange --no-commit
git commit -m "reverted commits $sharange"
这篇关于恢复特定作者自特定时间以来的所有提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文