Posted By: Anonymous
Given a change that has been committed using
commit, and then reverted using
revert, what is the best way to then undo that revert?
Ideally, this should be done with a new commit, so as to not re-write history.
If you haven’t pushed that change yet,
git reset --hard HEAD^
Otherwise, reverting the revert is perfectly fine.
Another way is to
git checkout HEAD^^ -- . and then
git add -A && git commit.
Answered By: Anonymous
- What's the difference between "git reset" and "git…
- Various ways to remove local Git changes
- In plain English, what does "git reset" do?
- Checkout another branch when there are uncommitted…
- How to use Git Revert
- How can I move HEAD back to a previous location?…
- How do I revert a Git repository to a previous commit?
- How do I make a Git commit in the past?
- How to git reset --hard a subdirectory?
- Git: Create a branch from unstaged/uncommitted…
- How do I use 'git reset --hard HEAD' to revert to a…
- How to revert multiple git commits?
- Issue with iron-ajax request
- easiest way to extract Oracle form xml format data
- How to undo local changes to a specific file
- How do you 'redo' changes after 'undo' with Emacs?
- How can I reconcile detached HEAD with master/origin?
- Git submodule head 'reference is not a tree' error
- git pull while not in a git directory
- Homebrew install specific version of formula?
- Why do I have to "git push --set-upstream origin "?
- How to un-commit last un-pushed git commit without…
- Git workflow and rebase vs merge questions
- Retrieve specific commit from a remote Git repository
- Git undo changes in some files
- Why does Git say my master branch is "already up to…
- git status shows modifications, git checkout --…
- Git Using Remote Branch
- "git rm --cached x" vs "git reset head -- x"?
- Is it safe to shallow clone with --depth 1, create…
- What's the difference between HEAD^ and HEAD~ in Git?
- How do I undo the most recent local commits in Git?
- git lfs push to github failure on Ubuntu 18.04
- Git, How to reset origin/master to a commit?
- What is git tag, How to create tags & How to…
- Backbone.js: TypeError: Object # has no method 'parse'
- git push says "everything up-to-date" even though I…
- Why did my Git repo enter a detached HEAD state?
- Need to reset git branch to origin version
- How to recover stashed uncommitted changes
- Difference between git checkout --track…
- Remove specific commit
- How to pull in changes from skeleton sub-repository…
- Git - Pushing code to two remotes
- How can I switch to another branch in git?
- Recalculate merge conflicts (ie. how to generate…
- How to track untracked content?
- How to undo 'git reset'?
- using reset on a collection vs add - why do they…
- Git: Remove committed file after push
- How does PHP 'foreach' actually work?
- git undo all uncommitted or unsaved changes
- git bring some "older" changes to a new branch after…
- Is it possible to do a sparse checkout without…
- How to fix Git error: object file is empty?
- Undo a particular commit in Git that's been pushed…
- Why are there two ways to unstage a file in Git?
- Undo a Git merge that hasn't been pushed yet
- Undo git pull, how to bring repos to old state
- How do I undo 'git add' before commit?
- Simple tool to 'accept theirs' or 'accept mine' on a…
- moving committed (but not pushed) changes to a new…
- Git - Undo pushed commits
- Delete commits from a branch in Git
- How do i arrange images inside a div?
- Resetting remote to a certain commit
- git stash blunder: git stash pop and ended up with…
- Git: can't undo local changes (error: path ... is unmerged)
- Move the most recent commit(s) to a new branch with Git
- safe way to revert git branch to last commit?
- Angular Karma - Component undefined
- How to modify existing, unpushed commit messages?
- How to retrieve a single file from a specific…
- Why do git fetch origin and git fetch : behave differently?
- How can I undo git reset --hard HEAD~1?
- What's the difference between git reset --mixed,…
- How can I revert a single file to a previous version?
- How to keep a clean browser history in a backbone.js app?
- Merge, update, and pull Git branches without using checkouts
- master branch and 'origin/master' have diverged, how…
- Git merge master into feature branch
- Programmatically navigate using React router
- Undo a merge by pull request?
- How to undo "git commit --amend" done instead of…
- Practical uses of git reset --soft?
- Does "git fetch --tags" include "git fetch"?
- How to get just one file from another branch
- Why does git say "Pull is not possible because you…
- Squash the first two commits in Git?
- Ember yield multiple actions into component
- java.lang.IllegalStateException: Cannot (forward |…
- How to commit my current changes to a different…
- How to overwrite local history with remote?
- How to extract img src, title and alt from html using php?
- Why does the function named "traverse" not work on my code?
- Git submodule update
- Pushing new commit from detached head back to origin…
- EmberJS History/Undo
- Why does git perform fast-forward merges by default?
- Checking out Git tag leads to "detached HEAD state"