Common Issue with Git Visual Studio
1. Visual Studio Git Merge or Commit error
If you're using Visual Studio Git.Merge code from source branch to target branch and there's new commit at target branch, you might see following error.
An error occurred. Detailed message: 2 uncommitted changes would be overwritten by merge
You'll probably still see this error after try couple time pull operation from target branch. I think this might be a bug for using Visual Studio git, but some people saying it might be file be locked, anyway it is something should working but git VS is not doing correctly. So following are the fix I have tried and works so far.
- After check out to target branch always pull first then do other operation like merge or push.
- #1 although most of the time should work fine, however, if you forgot to pull or even after you pull someone to push their you might still see above error.
- Restart Visual Studio, this might works
- Open command line from your current source folder and type following.
git status git pull
2. Visual Studio Git - cannot undo change but not change on file
Sometimes although there are not change in files you can't undo changes by using Git at Visual Studio. You can try following git command line
git reset git checkout .