I noticed I never see in the mode line in which VCS branch I'm currently in, when I open a file in Emacs.

So I tried it with an empty Emacs, created a folder in Eshell, called ~/foo , and initialized Git with git init inside ~/foo. Then I have Emacs created a buffer inside ~/foo with M-x find-file bar.txt. I saved the file, and in Eshell I did [user ~/foo] git add bar.txt.

But I don't see any VCS-related in the mode line. When I run C-x v = Emacs tells me that bar.txt is not under version control. And the same story when I revert the buffer.

When I do the following M-: (eval (executable-find "git"), it pointed to /usr/bin/git which is correct.

Auto-revert-modedidn't help it. What else can I do in order to figure out how this issue is caused? Git in terminal tells me that bar.txt is recognized and tracked by Git.

  • 1
    M-: is a command to evaluate an expression, so there's no need to use eval within it.
    – Stefan
    Apr 10, 2018 at 12:06
  • Have you tried with emacs -Q?
    – Stefan
    Apr 10, 2018 at 12:07

3 Answers 3


The VC packages uses caching, and in many places assumes that the user interacts with VCS systems (e.g. Git) through it.

To register a new file in a Git repository, press C-x v v, you don't need to use Eshell for that.

If you've changed a buffer's status using something else than VC commands, though, you can visit the file again to refresh the status information. The easiest way to do that, IMO, is M-x revert-buffer.

Also make sure that vc-handled-backends includes Git, which it does by default.

  • Thanks for your response. I tried C-x v v and I got only the message "Use VC backend:" with an empty list in helm-mode-vc-next-action". Still no master or any branch in mode line.
    – ReneFroger
    May 14, 2017 at 19:01
  • Could you try running Emacs with -Q and then repeating the procedure again? I'm wondering if some other package or setting you've got enabled is causing the problem.
    – stevoooo
    May 14, 2017 at 19:04
  • Helm is an obvious culprit, going by helm-mode-vc-next-action being present in the scenario.
    – Dmitry
    May 14, 2017 at 19:23
  • I included (setq vc-handled-backends "Git") and evaluated it. But when I call C-x v v, I got the error Wrong type argument: symbolp, 71 and there is no command helm-mode-vc-next-action in M-x. What would you suggest?
    – ReneFroger
    May 15, 2017 at 16:59
  • 1
    @ReneFroger That happens. VC doesn't know how to diff against a branch that contains zero revisions.
    – Dmitry
    May 15, 2017 at 22:49

Use C-x C-v (find-alternate-file) to reload bar.txt. You should then see "Git@master" in the mode line.

  • It didn't help, sorry.
    – ReneFroger
    May 14, 2017 at 18:59

Check your vc-git-program value. I just hit this issue and found that I had customised it (well actually vc-hg-program in my case) and the program was missing from the specified location.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.