Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you list tracked files (git ls-files) in magit?

Tags:

git

emacs

magit

How do you list tracked files (git ls-files) in magit?

like image 962
eludom Avatar asked Jul 28 '14 11:07

eludom


People also ask

Which command provides the list of tracked files in git?

ls-tree will output all the versioned files.

Which command provide the list of tracked files?

--full-tree makes the command run as if you were in the repo's root directory. -r recurses into subdirectories. Combined with --full-tree, this gives you all committed, tracked files.


1 Answers

@tarsius is right about the fact that there is currently no built-in command for doing this.

You can, however, do this:

: ls-files RET

: is bound to magit-git-command which allows you to

Execute a Git subcommand asynchronously, displaying the output. With a prefix argument run Git in the root of the current repository. [...]


You can of course automate the process described above by recording a keyboard macro or defining a custom command and binding it to a key sequence of your choice:

(defun magit-ls-files ()
  "List tracked files of current repository."
  (interactive)
  (if (derived-mode-p 'magit-mode)
      (magit-git-command "ls-files" default-directory)
    (message "Not in a Magit buffer.")))

(define-key magit-mode-map (kbd "K") 'magit-ls-files)
like image 50
itsjeyd Avatar answered Oct 27 '22 04:10

itsjeyd