git-revert

Lost all my staged but uncommited modifications after git revert --abort command

不羁的心 提交于 2019-12-01 10:46:17
问题 I think I just totally messed up. I've been working on a project for 2 days and I was trying Magit in emacs to commit the project but I kept getting back to the staging area without finishing the commit. Long story short, I exited emacs and was back in the command line and everything was fine with the files, but git status said that I should do a git revert --abort or some other option I don't recall now. Well, git revert --abort seemed ok, since I wanted to abort whatever git was doing and

Restore deleted file not staged in git

廉价感情. 提交于 2019-12-01 03:21:00
I accidentally removed the entire directory of my source code...with a nice rm -r. I know, really bad; but fortunately, I had a git repo in the containing directory. Thus, git has a huge list of unstaged changes of deleted files. For example: "deleted: src/caronmonitor/server.py" How do I get these files back? There is advice all over the web to do: git checkout file or git revert <commit> But as I understand that will restore the file to it's state at the last commit. I don't want to go back to the last commit but instead go back to right before the delete operation. I can look in the gitk

Redo bad git conflict resolution after push

别等时光非礼了梦想. 提交于 2019-11-30 19:21:49
I want to re-create a merge conflict so I can resolve it correctly the second time round. Example: Branch 'A' checked out. Branch 'B' is merged In. Conflicts resolved from merge (creates merge commit). Push to remote. Other people merge into Branch 'A' and push to remote. Oh dear I have realised my conflict resolution was wrong, I went with theirs instead of mine, whatever. Now what? I essentially want to re-do the conflict resolution part . I don't have the option of re-setting my HEAD as the branch has already been pushed to the remote; and has the possibility of other people having

Reverting a git merge commit, then reverting the revert

▼魔方 西西 提交于 2019-11-30 15:07:54
问题 Our team uses Github Pull Requests to manage our workflow, much like what is described here. Upon manually reviewing the accepted Pull Request, we occasionally need to revert that merge because it isn't ready for deployment to our production servers. However, if a developer attempts to issue a Pull Request again, it does not recognize these changes were reverted and sees that the commits are already in the master branch. It only will include their recent commits since the revert, but what we

Reverting a git merge commit, then reverting the revert

北城余情 提交于 2019-11-30 13:47:13
Our team uses Github Pull Requests to manage our workflow, much like what is described here . Upon manually reviewing the accepted Pull Request, we occasionally need to revert that merge because it isn't ready for deployment to our production servers. However, if a developer attempts to issue a Pull Request again, it does not recognize these changes were reverted and sees that the commits are already in the master branch. It only will include their recent commits since the revert, but what we really want is to reintroduce ALL of the commits there were reverted, plus their new work. In other

Git revert certain files

我是研究僧i 提交于 2019-11-30 11:13:51
I want to do a revert of a commit, but only for some files. ( Not a checkout; a revert. If you are unfamiliar with the difference, keep reading.) I tried this git revert --no-commit abcdef123456 -- my/path/to/revert And I got this error fatal: ambiguous argument 'my/path/to/revert': unknown revision or path not in the working tree. Use '--' to separate paths from revisions But that is precisely what I did! (And yes, my/path/to/revert is in my working tree.) My working theory is that it is not possible to revert only some files, and that the Git error message is misleading. (Git 1.7.9.5) This

Avoid the effects of a revert commit in another Git branch while merging

爷,独闯天下 提交于 2019-11-30 07:13:15
Working with git flow. We have a co-worker who is not familiar with Git that accidentally merged develop into master yesterday. Develop has quite a few features that are launching with our next release, requiring a revert on the merge. This has created a commit which undoes all of the changes. When we merge master back into develop, the revert commit is removing code generated by our features. What is the best way of going about being able to synchronize develop with master's hotfixes, while preserving the new features? -- Edit -- Just to clarify, the revert was a revert . I.E. git revert -m 1

Redo bad git conflict resolution after push

為{幸葍}努か 提交于 2019-11-30 03:27:38
问题 I want to re-create a merge conflict so I can resolve it correctly the second time round. Example: Branch 'A' checked out. Branch 'B' is merged In. Conflicts resolved from merge (creates merge commit). Push to remote. Other people merge into Branch 'A' and push to remote. Oh dear I have realised my conflict resolution was wrong, I went with theirs instead of mine, whatever. Now what? I essentially want to re-do the conflict resolution part . I don't have the option of re-setting my HEAD as

Reverting specific commits from git

南楼画角 提交于 2019-11-29 20:35:15
I have a git tree with a lot of commits and a lot of files. Now, I want to revert specific commits that touch a file only. To explain: > git init Initialized empty Git repository in /home/psankar/specific/.git/ > echo "File a" > a > git add a ; git commit -m "File a" [master (root-commit) 5267c21] File a 1 file changed, 1 insertion(+) create mode 100644 a > echo "File b" > b > git add b; git commit -m "File b" [master 7b560ae] File b 1 file changed, 1 insertion(+) create mode 100644 b > echo "File c" > c > git add c; git commit -m "File c" [master fd6c132] File c 1 file changed, 1 insertion(+)

Avoid the effects of a revert commit in another Git branch while merging

偶尔善良 提交于 2019-11-29 09:53:42
问题 Working with git flow. We have a co-worker who is not familiar with Git that accidentally merged develop into master yesterday. Develop has quite a few features that are launching with our next release, requiring a revert on the merge. This has created a commit which undoes all of the changes. When we merge master back into develop, the revert commit is removing code generated by our features. What is the best way of going about being able to synchronize develop with master's hotfixes, while