Here is my current custom, but I don't know how to customize its face. And it only shows branch name, no other status info.

    (if vc-mode
           (propertize " ⭠"
                       'face '(:foreground "sky blue"))
           ;; TODO: propertize this. set face height to 75
           `(vc-mode vc-mode)

I hope someone can give out a better solution. Or at least tell me how to custom my upper status (vc-mode vc-mode) face.

  • Can you further suggest how to display the current branch in the dired modeline? Commented May 12, 2017 at 18:20

1 Answer 1


In git, if you hover the mouse over the mode line portion which starts "Git", you get more information such as the branch and update status.

Looks like you've asked about mode line customization before here and here, so you should understand how to set values in the mode line.

To get the status of the file, the function you want is:

(vc-state (buffer-file-name (current-buffer)))

And to get the branch:

(vc-working-revision (buffer-file-name (current-buffer)))
  • 2
    For me (vc-working-revision (buffer-file-name (current-buffer))) return a hash number instead of a branch name like "master"
    – user27072
    Commented Mar 23, 2020 at 11:57
  • @run_the_race - ok. Basically the command git rev-parse HEAD is run. GNU Emacs is open source, feel free to suggest changes to it, or post another solution. The particular file is to changer is git.savannah.gnu.org/cgit/emacs.git/tree/lisp/vc/vc-git.el#n349
    – rocky
    Commented Mar 24, 2020 at 13:32
  • @rocky What about show git's branch name in mode line on Dired mode? Commented Sep 29, 2021 at 12:01
  • @a_subscriber haven't a clue. Maybe you should post that as its own question if you are looking for an answer.
    – rocky
    Commented Sep 30, 2021 at 13:43
  • @rocky I found. This help github.com/10sr/git-ps1-mode-el Commented Sep 30, 2021 at 13:48

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.