0
  • State1: A file has a value 'A'
  • State2: value changed to 'B'
  • State3: Git add(put in index/staging area)
  • State4: File committed(put in repository)

I want to do a revert to get to State3(put in staging area) or just state2. Effectively deleting the commit. How can I do it? I cannot find anything that does this.

These are my findings. Are they correct?

  • Checkout: revert to State1
  • Reset: revert to State1
  • Revert: revert to State1

Edit: State3 is optional as State4 does that for you. It is not "put in index" but "edit in index"

Blue Clouds
  • 7,295
  • 4
  • 71
  • 112
  • 1
    Please read [ask] and show what you have tried. You also combined two steps into one at "State2". First you change the file on disk, then you do a `git add` to put it in the staging area. So "reverting a commit back to staging" is as simple as resetting and doing a `git add` again. – CodeCaster Jun 28 '18 at 12:38
  • 1
    changed the question to reflect your suggestion. I was confused about that part. – Blue Clouds Jun 28 '18 at 12:45

0 Answers0