What is the difference between “Revert Commit” and “Undo Commit” in IntelliJ IDEA?

Undo the last commit IntelliJ IDEA allows you to undo the last commit in the current branch (for example, HEAD). Note: You cannot undo a commit if it was pushed to a protected branch, that is a branch to which force –push is not allowed (configure protected branches in the Settings/Preferences dialog Ctrl+Alt+S under Version … Read more

Undo delete in GIT

Do yourself a favour and do not do git checkout <hash> like the other answer suggests and go into more problems. IF you have deleted file from your working directory and not committed the changes yet, do: git checkout -f CAUTION: commit uncommitted files before executing this command, otherwise you’re going to lose them all … 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

Git pull into wrong branch

git reset –hard ORIG_HEAD From the git reset man page (if you just did the pull): Undo a merge or pull $ git pull (1) Auto-merging nitfol CONFLICT (content): Merge conflict in nitfol Automatic merge failed; fix conflicts and then commit the result. $ git reset –hard (2) $ git pull . topic/branch (3) Updating … Read more

Using Vim’s persistent undo?

Put this in your .vimrc to create an undodir if it doesn’t exist and enable persistent undo. Tested on both Windows and Linux. ” Put plugins and dictionaries in this dir (also on Windows) let vimDir=”$HOME/.vim” if stridx(&runtimepath, expand(vimDir)) == -1 ” vimDir is not on runtimepath, add it let &runtimepath.=’,’.vimDir endif ” Keep undo … Read more

What is difference between ‘git reset –hard HEAD~1’ and ‘git reset –soft HEAD~1’?

git reset does know five “modes”: soft, mixed, hard, merge and keep. I will start with the first three, since these are the modes you’ll usually encounter. After that you’ll find a nice little a bonus, so stay tuned. Let’s assume you have a repository with a history akin to this: 7e05a95 (HEAD -> main) … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)