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 8/10 Helpfulness 2/10

Contents


More Related Answers

  • git reset to latest commit
  • git revert last commit
  • git revert latest commit
  • Revert to the previous commit in git
  • revert back to a commit git
  • revert last commit
  • git reset head to previous commit
  • reset or revert last commit
  • git back to last commit
  • git revert last commit
  • git how to roll back to a commit
  • github restore previous commit
  • how to revert back to one commit
  • revert last commit git
  • git revert to last commit
  • how to revert to last git commit
  • undo most recent commit
  • how do i undo the most recent commits in git
  • revert changes of a previous commit git
  • git how to rollback to previous commit
  • git revert a commit
  • How do I revert a Git repository to a previous commit?
  • revert last commit
  • How do I revert a Git repository to a previous commit?
  • reset git from last commit
  • rollback to a previous commit
  • Undo revert 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 8/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 10/10 Helpfulness 4/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.