Search code examples
gitcommitrestorerollback

How can I return to a specific GIT commit without miss any changes from that date to now?


I have a list of commits, I want to restore on of them, but without messing with the rest of the changes... I want to restore ONLY the changes made on that commit, can I?


Solution

  • If I understand your question, you are trying to reverse a commit which is some time before your current HEAD without reversing the commits afterwards.

    To do so, use git revert <commit>

    git revert creates a new commit that reverses the specified commit(s).

    man page: http://www.kernel.org/pub/software/scm/git/docs/git-revert.html