Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RStudio revert button seems to act like Git reset

I am quite new to RStudio and Git, so I would like to make sure that I understand correctly what I am doing.

The Git documentation says that git revert creates a new commit. When I press the RStudio revert button, no new commit is created, it just goes back to the last commit. To me this seems to be a git reset --hard. Did I get anything wrong?

like image 349
Christoph Avatar asked Apr 07 '16 16:04

Christoph


1 Answers

RStudio Revert functionality differs from git reset functionality.

According to this manual git reset --hard do this

Resets the index and working tree. Any changes to tracked files in the working tree since are discarded.

So your full project will return to previous commit state

But according to this RStudio Revert Changes popup window:
only selected file will be changed to previous commit state.

enter image description here

And this can be done with git combination of

  • git reset file (Unstage a file)
  • git checkout file (Discard changes in the working directory)

See more about resetting, checking and reverting here

like image 57
alexander.polomodov Avatar answered Oct 26 '22 23:10

alexander.polomodov