How to undo a git pull?

Or to make it more explicit than the other answer: git pull whoops? git reset –keep HEAD@{1} Versions of git older than 1.7.1 do not have –keep. If you use such version, you could use –hard – but that is a dangerous operation because it loses any local changes. To the commenter ORIG_HEAD is previous … Read more

DbContext discard changes without disposing

public void RejectChanges() { foreach (var entry in ChangeTracker.Entries()) { switch (entry.State) { case EntityState.Modified: case EntityState.Deleted: entry.State = EntityState.Modified; //Revert changes made to deleted entity. entry.State = EntityState.Unchanged; break; case EntityState.Added: entry.State = EntityState.Detached; break; } } } Update: Some users suggest to add .ToList() to avoid ‘collection was modified’ exception. But I believe … Read more