Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

reverting a old commit

Vivek Kakadan answered on December 28, 2020 Popularity 7/10 Helpfulness 2/10

Contents


More Related Answers

  • git reset to latest commit
  • git revert latest commit
  • Revert to the previous commit in git
  • revert back to a commit git
  • git reset head to previous commit
  • revert last commit
  • git reset to last commit local
  • to undo a commit in git
  • reset or revert last commit
  • git revert last commit
  • git back to last commit
  • git how to roll back to a commit
  • github restore previous commit
  • revert last commit git
  • git revert to last commit
  • git revert back to specific commit
  • revert changes of a previous commit git
  • undo most recent commit
  • how to revert to last git commit
  • how do i undo the most recent commits in git
  • how to revert back to one commit
  • How to revert commit in Git
  • git revert a commit
  • git how to rollback to previous commit
  • How do I revert a Git repository to a previous commit?
  • How do I revert a Git repository to a previous commit?
  • revert last commit
  • reset git from last commit

  • reverting a old commit

    0

    I have a simple solution using a patch to revert all your changes.

    1. Checkout current head branch (e.g. develop)

    git checkout develop

    2. Lookup your commit-id in the history log, and check out only your changes into a new branch:

    git log

    git checkout -b your-branch

    3. Look up in your branch, and find the previous status you want to revert to:

    git checkout -b prev-status

    4. Create a patch that can revert all your changes:

    git diff your-branch..prev-status > reverts.patch

    # the comparing order of branches is important

    5. checkout current head branch and apply the reverting patch

    git checkout origin develop

    git apply reverts.patch

    git add *

    git commit -m "revert all my changes" 

    Popularity 7/10 Helpfulness 2/10 Language whatever
    Source: Grepper
    Link to this answer
    Share Copy Link
    Contributed on Mar 13 2023
    Vivek Kakadan
    0 Answers  Avg Quality 2/10

    Closely Related Answers



    0
    Popularity 9/10 Helpfulness 5/10 Language shell
    Tags: commit co
    Link to this answer
    Share Copy Link
    Contributed on May 04 2021
    Wicked Worm
    0 Answers  Avg Quality 2/10

    -1
    Popularity 10/10 Helpfulness 4/10 Language shell
    Tags: commit co
    Link to this answer
    Share Copy Link
    Contributed on Dec 28 2020
    thecameroncobb
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.