git-revert

How to revert changes from old commit in a single file

丶灬走出姿态 提交于 2021-02-16 14:28:11
问题 How do I revert/remove the changes done in an older multi-file commit, but only do it in a single file? I.e. something like git revert <commit-specifier> <file> except git revert does not accept <file> argument. None of the following answers addresses this problem: Git: Revert old commit on single file is rather about how to debug conflicts. Undo a particular commit in Git that's been pushed to remote repos does not address my single file issue. Git: revert on older commit also does not

Git: Revert old commit on single file

試著忘記壹切 提交于 2021-01-28 19:51:56
问题 I'm pretty new to using revert in git, and I'm wondering if something like the following can be done. Let's say I have made a few commits already, and I have a (self-explanitory) text file which looks like the following: This line was added at commit AAAAA This line was added at commit BBBBB This line was added at commit CCCCC I would like to use revert to remove the changes made by commit BBBBB, to get a file that looks like this: This line was added at commit AAAAA This line was added at

error: Reverting is not possible because you have unmerged files

自作多情 提交于 2020-07-15 12:06:25
问题 When trying to revert a specific commit in git, I'm getting this error: $ git revert aaaf93201a28a57d540d633b1b723b8e513a47ed error: Reverting is not possible because you have unmerged files. hint: Fix them up in the work tree, and then use 'git add/rm ' hint: as appropriate to mark resolution and make a commit. fatal: revert failed Is this about merge conflicts? But why does it say "unmerged files" in that case? 回答1: It is about merge conflicts, from some merge you attempted before. The

error: Reverting is not possible because you have unmerged files

末鹿安然 提交于 2020-07-15 12:05:00
问题 When trying to revert a specific commit in git, I'm getting this error: $ git revert aaaf93201a28a57d540d633b1b723b8e513a47ed error: Reverting is not possible because you have unmerged files. hint: Fix them up in the work tree, and then use 'git add/rm ' hint: as appropriate to mark resolution and make a commit. fatal: revert failed Is this about merge conflicts? But why does it say "unmerged files" in that case? 回答1: It is about merge conflicts, from some merge you attempted before. The

Git Revert Error Message?

时光总嘲笑我的痴心妄想 提交于 2020-01-02 04:47:12
问题 While trying to revert a commit I made to my repository of my .emacs.d folder I get the following message: haziz@haziz> git revert 7fe3f error: could not revert 7fe3f0b... .emacs.d contents from ubuntu hp 15 hint: after resolving the conflicts, mark the corrected paths hint: with 'git add <paths>' or 'git rm <paths>' hint: and commit the result with 'git commit' What I am trying to do is reverse changes I made to my init.el file and have followed with another commit which I am trying to

How to revert a merge which used strategy=ours?

烈酒焚心 提交于 2020-01-02 01:46:37
问题 I'm working with a repository where a merge was performed weeks ago which we just discovered used the --strategy=ours flag (it was supposed to use the --strategy-option=ours flag), thus not applying any changes to HEAD. However, we need to have the changes applied. Git already recognizes the branch as being merged and the commits in the history of the branch. This sort of merge can't be reverted using git revert -m ... What would be the proper way of reverting and/or re-applying the merge to