0

On Windows 10, using Visual Studio Code and GitLens, my ability to diff between remotes and local branches works fine...except for on the master branch. On the master branch I'm choosing to compare origin/Master to master. I'm correctly told that there are dozens of changed files.

enter image description here

When I click on any of the changed files, I'm consistently given the same result:

enter image description here

No matter what kind of file change I select on the left (add, delete, modify), the comparison shows one changed blank line.

The weirdness does not end there. If I type git status I'm given this response:

On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
    modified:   .gitignore

no changes added to commit (use "git add" and/or "git commit -a")

In this example, there is indication of neither how many commits "behind" I am, nor that I am "up to date." If I switch to any other branch and issue git status, I am given a "normal" message about being "up to date" or how "behind" or "ahead" I am. Likewise, GitLens correctly shows diffs of the files on those branches.

In short, something is screwed up with the master branch. Any ideas?

I've consulted this SO post about chmod changes or cr/lf changes. I don't think any of that applies.

For what it is worth, when I attempt git diff I'm shown this:

diff --git a/.gitignore b/.gitignore
index 17e65aa..8dfbc42 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,3 +27,6 @@ override.tf.json

 # Do not commit bin files that have been compiled
 vpc_transit/bin/*
+
+# Python
+__pycache__
\ No newline at end of file

Update

Github ticket with Gitlens.

Brent Arias
  • 29,277
  • 40
  • 133
  • 234
  • *Probably* not relevant, but why is `origin/Master` capitalized when `master` is all lowercase? Given Windows' case-folding tricks, if the actual name is `origin/master`, this sort of thing sometimes works and sometimes fails, in ways that appear very mysterious. (They're actually well-defined but depend on a lot of internal state, including file-system files that may not be used for anything except making things mysterious, and may be cleaned up by Git before a future command, making things even more mysterious.) – torek Jan 28 '20 at 20:31
  • @torek I think you are on to something. Just now, based on [this SO post](https://stackoverflow.com/questions/171550/find-out-which-remote-branch-a-local-branch-is-tracking), I ran `git branch -vv`. Looks like master has no remote tracking branch. :( – Brent Arias Jan 28 '20 at 20:51
  • I don't use these Visual Studio thingies, but from the command line, you can `git branch --set-upstream-to=origin/master master` to set the upstream of `master` to `origin/master`. See also https://stackoverflow.com/questions/37770467/why-do-i-have-to-git-push-set-upstream-origin-branch/37770744#37770744 – torek Jan 28 '20 at 20:55
  • Whoa! That helped, `git status` now works correctly, but the diffing problem remains the same. Still investigating. – Brent Arias Jan 28 '20 at 21:10

0 Answers0