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.
Answered By – Chris