Tom
Tom

Reputation: 5052

Git seems to be reverting back to previous changes on its own

I'm using Git with Rstudio and pushing to Github and I can't quite figure out some of this behavior.

I don't think I can reproduce this, but here's what's happening.

I committed and pushed to github. Note the green additions on lines 156-159.

I then made other changes and committed again and my previous changes were removed (red lines 155-167).

I'm no Git wiz so I couldn't figure how how to revert part of a commit so I just manually added the changes back in with this commit. (Green lines 156-169)

I can't figure out why this might have reverted by itself and I'm almost positive that I didn't delete the lines myself. Is there something I could be inadvertently doing that is causing this to happen?

Upvotes: 1

Views: 161

Answers (1)

VonC
VonC

Reputation: 1323135

Is there something I could be inadvertently doing that is causing this to happen?

With Git itself, not much: it only takes what it sees in the working tree to add it and commit it.
It should be the RStudio IDE which somehow misfired and removed that part just before the second commit.

The only Git operation which "revert" changes (beside git revert itself) is git reset.

Upvotes: 1

Related Questions