Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6901139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:38:08+00:00 2026-05-27T07:38:08+00:00

As far as I know, when you want to undo something in Git you

  • 0

As far as I know, when you want to undo something in Git you have to explicitly find the command to undo whatever it is you’ve done and issue it. For instance, one way among many to undo a commit and redo it is to follow the example from here,

$ git commit ...
$ git reset --soft HEAD^
$ edit
$ git add ....
$ git commit -c ORIG_HEAD 

Or to undo a pull, you can follow the instructions from here,

$ git reset --hard

But these commands do not necessarily work interchangeably. Is there a reason why Git does not allow simple undo and redo commands? Something to do with the philosophy behind it? Also, I don’t have much experience with other version control systems, but do any of them offer a simple undo and redo command?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T07:38:09+00:00Added an answer on May 27, 2026 at 7:38 am

    There are several problems with such a notion:

    • Not all operations are reversible. Sometimes this is because Git doesn’t record enough information to deduce the prior state – that’d be prohibitively expensive in general. Sometimes it’s things like git reset --hard or git clean, which destroy untracked changes. In order to undo them, it’d have to be continuously automatically backing up. Sometimes this is because the notion of undo is ambiguous – as you yourself pointed out, there are many ways to undo a commit.

    • If an operation is reversible, and it involved some sort of history, should the undo/redo also be in the history, or should they make it vanish? Should a commit be undone by resetting back, or by reverting (creating another commit to cancel it)?

    • Without logging every last thing you do, how would you know what the most recent operation was? Say you added a file to the index, and created a branch. There’s no record of which was first.

    Even if everything were clearly defined, it’d be an absurd amount of work to implement. How do you decide what constitutes a single action? A single Git command might do many things. Should it undo one step, the whole thing? What if you’ve run a zillion commands each doing a tiny step and you want to undo it all? And it’d have to be perfect, completely perfect, because it’s the kind of feature that will be used by inexperienced users who’ll have no idea how to recover from any mistake.

    So, just as Git gives you the tools to do things, it gives you the tools to see what you’ve done, and undo things yourself if so desired.

    Also, with respect to “redo”, as you defined it in your question, it’s repeating a command, not doing the original operation again. When you redid a commit, it was a different one. Re-running a previous command is something that command-line shells were designed to do. Git doesn’t need to reinvent it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JEditorPane in a JPanel. I want to know how far from
As far as I know, in gcc you can write something like: #define DBGPRINT(fmt...)
I want to know how far the video had progressed when the user closes
as far i know how to get innerHTML but now i want to get
As far as I know, for using @Annotations (or [Attributes] in C#) you have
As far as know, I must be careful with PHP, and I think Javascript.
As far as I know, foreign keys (FK) are used to aid the programmer
As far as I know, Flash has to pass info off to another external
As far as i know it is not possible to do the following in
As far as I know (not much I'll admit), the currently popular programming paradigms

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.