revert

Git: How to revert 2 files that are stubbornly stuck at “Changed but not committed”?

余生长醉 提交于 2019-11-28 14:23:55
问题 I have a repo that has two files that supposedly I changed locally. So I'm stuck with this: $ git status # On branch master # Changed but not updated: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: dir1/foo.aspx # modified: dir2/foo.aspx # no changes added to commit (use "git add" and/or "git commit -a") Doing git diff says that the entire file contents have changed, even though from

git revert back to certain commit [duplicate]

六眼飞鱼酱① 提交于 2019-11-28 13:48:38
问题 This question already has an answer here: How do I revert a Git repository to a previous commit? 42 answers how do i revert all my files on my local copy back to a certain commit? commit 4a155e5b3b4548f5f8139b5210b9bb477fa549de Author: John Doe <Doe.John.10@gmail.com> Date: Thu Jul 21 20:51:38 2011 -0500 This is the commit i'd like to revert back to. any help would be a lifesaver! 回答1: git reset --hard 4a155e5 Will move the HEAD back to where you want to be. There may be other references

Undo an accidental hg strip?

怎甘沉沦 提交于 2019-11-28 13:21:19
I have accidentally run hg strip, and deleted a stack of commits. I have not done anything in the repo since. Is there a way for me to bring back this stack of commits, to undo the hg strip I just ran? As long as you didn't run the strip with the --no-backup option, the stripped changesets can be found in the repository under .hg\strip-backup . If you sort the directory content by date the latest one is likely the one you need to restore. Restore it with hg unbundle <filename> . Here is a worked example from an external post . I've cleaned it up slightly to make it a little more general:

Git undo changes in some files [duplicate]

筅森魡賤 提交于 2019-11-28 02:36:34
This question already has an answer here: Undo working copy modifications of one file in Git? 13 answers While coding I added print statements into some files to keep track of what was going on. When I am done, is it possible to revert changes in some files, but commit the file I actually worked on? Say I added print in file A , but I modified file B . B is what I want to commit and A , I want to be set back to its old state. There are three basic ways to do this depending on what you have done with the changes to the file A. If you have not yet added the changes to the index or committed them

Is there a way to recover from an accidental “svn revert”?

不问归期 提交于 2019-11-27 18:26:17
I managed to shoot myself in the foot this morning by doing the following: Started working on a change to my project Made a bunch of edits to a bunch of files Realized that my approach was all wrong, and that I needed to start over cd'd to the top level of my project and did a "svn --recursive revert ." to restore my local sandbox to its pre-changes state. Howled in horror as I realized that there had been a number of other changes outstanding in my local sandbox, and I had just obliterated all of them. (the svn server had been down last Friday so I hadn't been able to check them in, and I had

How to revert multiple commits as part of a single commit

丶灬走出姿态 提交于 2019-11-27 17:04:23
问题 This is not a major problem, just something I want to know whether or not is possible. Let's say we have two commits, abcd123 and wxyz789 , that occur at non-adjacent, separate places, far back in a repo's history. Now let's say we want to revert them. Doing git revert abcd123 wxyz789 would result in two separate commits, one reverting abcd123 and the other reverting wxyz789 . This is all fine and well, but what if the mistakes we want to fix in the two commits are logically linked, and for

Adding a function to jQuery draggable revert “event”

℡╲_俬逩灬. 提交于 2019-11-27 14:37:38
What I have: I have a draggable div with a revert parameter set as "invalid". What I need: When the revert occurs I want to trigger a CSS change to another element. The problem: "revert" is parameter rather than an event so I'm experiencing great difficulty in triggering the required CSS change when the revert occurs. My code: $('#peg_icon').draggable({ revert: 'invalid', scroll: false, stack: "#peg_icon", drag: function(event, ui) { $('#peg_icon').css('background-image','url(images/peg-icon-when-dragged.png)'); } }); What I've tried: I've unsuccessfully attempted using "revert" as an event:

Is there any way to undo the effects of “git revert head”?

落花浮王杯 提交于 2019-11-27 11:45:02
I've accidentally run the command against the wrong branch in my repository - is there a way to undo this change? git revert just creates a new commit -- you can "remove" it with git reset --hard HEAD^ (be more careful with it, though!) jonescb The command git revert just creates a commit that undoes another. You should be able to run git revert HEAD again and it'll undo your previous undo and add another commit for that. Or you could do git reset --hard HEAD~ . But be careful with that last one as it erases data. HEAD~ means the commit before the current HEAD How about reverting the revert?

Reverting a single file to a previous version in git [duplicate]

只愿长相守 提交于 2019-11-27 05:43:40
This question already has an answer here: How can I reset or revert a file to a specific revision? 31 answers Is there a way to go through different commits on a file. Say I modified a file 5 times and I want to go back to change 2, after I already committed and pushed to a repository. In my understanding the only way is to keep many branches, have I got that right? If I'm right I'm gonna have hundreds of branches in a few days, so I'm probably not understanding it really. Could anyone clear that up please? Let's start with a qualitative description of what we want to do (much of this is said

Undo an accidental hg strip?

你说的曾经没有我的故事 提交于 2019-11-27 04:45:29
问题 I have accidentally run hg strip, and deleted a stack of commits. I have not done anything in the repo since. Is there a way for me to bring back this stack of commits, to undo the hg strip I just ran? 回答1: As long as you didn't run the strip with the --no-backup option, the stripped changesets can be found in the repository under .hg\strip-backup . If you sort the directory content by date the latest one is likely the one you need to restore. Restore it with hg unbundle <filename> . 回答2: It