So I've been using Visual Studio Code (VS Code) for a while and working on my project with Git and had no problem. I was able to clone the git repository to a work space then I would see the "master" at the bottom left corner showing that I cloned a master branch and am working on the master branch. Then Normally I can click on it and select "Create new branch" and create my own branch such as "off_master".
I don't know why, but since little over a week ago, when I clone a git repository, it downloads the files, but I don't see the the word "master" at the bottom left of VS Code. And when I click on "Create new branch" and give a name, I get a general git error:
Git: Failed to execute git
and I see these in the git log:
> git rev-parse --show-toplevel
> git checkout -q -b off_Master
> git rev-parse --show-toplevel
I have no idea why it's starting to do this. So I've uninstalled VS Code, deleted this directory which seem to have all the VS Code settings:
C:\Users\<myId>\AppData\Roaming\Code\
I've then reinstalled VS Code with latest and same thing happens.
When I issue git status
from the directory which contains .git directory, I get an output like this:
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean
So it looks like I am using the master branch, but VS Code is not showing. And somehow I cannot create a new branch from VS Code.
I also tried a command like git config --list
and it does have correct user.name
, user.email
, and remote.origin.url
and these which look OK:
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
I am not very familiar with git, thus I use VS Code to drive the git, so it's very critical that I get this back to working state...
Any idea why this might be happening?
Only thing that makes me bit suspicious is that I was doing some stuff with Angular JS and upgraded NodeJS to do some stuff, but I wouldn't think these will have any impact to VS Code and git.
One other thing is that even if I removed that "Code" directory, when I reinstalled VS Code, it seemed to have all the extensions that I had installed previously, so it seems not everything was cleaned up.. How can I clean up everything so that it will look as if I am installing VS Code brand new? Perhaps doing this and reinstalling might help?
Very late reply, but I recently had this issue and found a solution for it.
Basically run git fetch --all
in CMD inside the project directory and they should show up.
Check if this is linked to the Git Lens VSCode plugin.
There have been some recent issues including issue 468.
You can launch VSCode with options, like --disable-extensions
to see if the issue persists and might come from one of the installed plugins.
SendETHToThisAddress reports in the comments:
I went to
Extensions >GitLens >settings icon >disable GitLens
.
Then ran the commandgit fetch --all
.
Finally the new branches appeared!
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