1

For example, I have file A.

Hello
World

I then add "Sad" to the second line.

Hello
Sad
World

The Github Desktop will then preview this uncommitted changes, that I have the new added changes on the second line. It will represent this line as green.

I also modify other 20 other files too in various places.

I then commit it. And push it. And request pull. And merged into master.

But then, there's actually a problem within any of the changes that I pushed. So the logical way is to revert the push / pull. But that means every changes that I made is lost. I need to copy and paste each of the changes into the related 20 files.

I want to revert the commit and push state, and re-apply the changes into the code -- without committing it. I need to be able to easily track the changes in the files in the form of uncommitted changes (because I can easily discard the changes for each of the files to track the problem), rather than in the form of committed changes, where everything has "set in stones".

How can I rewind back the time to the state where I still haven't committed the files yet, and the uncommitted changes still linger on the Github "uncommitted changes" section?

I have experienced using SVN before, where you can just easily browse through the history, right click on the file that changes within a history, and choose "revert this changes". And the file will revert into its unchanged form, vs the current head. So in the case above, the file will revert back into:

Hello
World

And the subversion will noted that the current head of the file is:

Hello
Sad
World

How can I achieve this? Thanks.

Thanks.

EDIT:

I think I've found the answer here:

https://stackoverflow.com/a/6866485/3003927

which explains the difference between reset with --HARD and reset without --HARD. Reset without --HARD looks like what I'm looking for.

Community
  • 1
  • 1
Chen Li Yong
  • 5,459
  • 8
  • 58
  • 124

0 Answers0