Reputation: 187
In Visual Studio Code (VSC), I have a folder open. That folder corresponds to a local git repo whose remote repo is on GitHub. The 2 repos are synchronized.
Next, I add a file to the remote repo by manually uploading the file and committing it.
Then, I synchronize the local repo by using the sync button in VSC. After I do that, in the VSC Source Control view, it shows 1 pending change which is the file I just added to the remote repo and the file is listed as an "uncommitted" change in VSC.
This is different from how I've used Git before on the command line or on tools other than VSC, like Eclipse, for example. I'm used to how doing this type of workflow would result in a Git fast-forward where the file that was just added to the remote repo would NOT show up as an uncommitted change; rather, the file would just be available in the local repo as a result of the git-pull.
As it stands now, I have to pointlessly recommit the "uncommitted" change in my local repo each time this workflow happens just to bring the 2 repos in sync again.
I assume I'm doing something wrong in VSC or have something misconfigured in VSC.
Any thoughts/suggestions?
Upvotes: 4
Views: 7484
Reputation: 187
It turns out this has nothing to do with VSC. The solution to the problem is actually based on SMB mount settings for file permissions and git configuration settings for file permission sensitivity.
The solution is described here.
Upvotes: 4
Reputation: 4014
When you manually uploaded and commit the file to github, it was created in your working directory, but never committed to your local repo. So naturally in the source control view (essentially git status
) it shows up as uncommitted.
To avoid confusions, I would change your workflow to never upload a file directly to the remote repo. Instead, commit it to your local repo first and push to remote.
Upvotes: 0
Reputation: 1323963
First, make sure you do have a commit before the VSCode Sync.
You should see:
Second, I would advise a rebase when syncing, by setting the VSCode git.rebaseWhenSync
to true.
That should replay your commit, making sure the committed file remains committed.
Upvotes: 0
Reputation: 78
There is an extension called rysnc which can be used to achieve this.
Sync-Rsync the documentation is clear about it's functionality.
for more about it's discussion here's a similar issue:
https://github.com/microsoft/vscode-remote-release/issues/196
Upvotes: 0