Can’t seem to discard changes in Git

This has been bothering me for a while, almost every repo I’d check out had changes that I couldn’t discard. Long story short, I tried all of the above, nothing worked. This is what I did to get things back to normal (on a Mac): Completely remove the autocrlf & safecrlf settings from ~/.gitconfig Completely … Read more

Mercurial — revert back to old version and continue from there

Here’s the cheat sheet on the commands: hg update changes your working copy parent revision and also changes the file content to match this new parent revision. This means that new commits will carry on from the revision you update to. hg revert changes the file content only and leaves the working copy parent revision … Read more

Revert a range of commits in git

What version of Git are you using? Reverting multiple commits in only supported in Git1.7.2+: see “Rollback to an old commit using revert multiple times.” for more details. The current git revert man page is only for the current Git version (1.7.4+). As the OP Alex Spurling reports in the comments: Upgrading to 1.7.4 works … Read more

How do I revert an SVN commit?

Both examples must work, but svn merge -r UPREV:LOWREV . undo range svn merge -c -REV . undo single revision in this syntax – if current dir is WC and (as in must done after every merge) you’ll commit results Do you want to see logs?

Remove specific commit

There are four ways of doing so: Clean way, reverting but keep in log the revert: git revert –strategy resolve <commit> Harsh way, remove altogether only the last commit: git reset –soft “HEAD^” Note: Avoid git reset –hard as it will also discard all changes in files since the last commit. If –soft does not … Read more

How do I “un-revert” a reverted Git commit?

git cherry-pick <original commit sha> Will make a copy of the original commit, essentially re-applying the commit Reverting the revert will do the same thing, with a messier commit message: git revert <commit sha of the revert> Either of these ways will allow you to git push without overwriting history, because it creates a new … Read more