While trying to checkout to a new branch in Visual Studio 2019, I'm getting the below error:
I tried to do the same from GitBash cmd
using the command git checkout branchname
but here also, I'm getting an error:
error: The following untracked working tree files would be overwritten by checkout:
//list of file names below
...
...
...
Aborting
I tried restarting VS also but it was of no help. Can you please assist?
I had this same error and solved it the following way, note I am calling my branch as myBranchName... Within visual studio in the git-manage branches screen, it just shows that error over and over. But, I navigated to the folder in windows, right-mouse context menu and chose 'git bash here' to open bash (which you can install along with GIT for windows in the same installer), in that folder. Then I typed
git checkout -b myBranchName
and pressed enter. This worked with no error. Then I returned to visual studio and it showed myBranchName in the bottom right of the screen.
Note: Also this all assumes your "new branch name" is an existing branch, in my case it was an existing branch that existed already remotely and locally when I got that error. If this is different from your question, then this may/may not help.
I was also facing the same issue and the below steps worked for me
\.git\refs\remotes
folder in my local systemgit checkout <branchname>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With