CINXE.COM

Git - git-ls-files Documentation

<!DOCTYPE html> <html lang="en"> <head> <script type="text/javascript"> const currentTheme = localStorage.getItem("theme") if (currentTheme) { const prefersDarkScheme = window.matchMedia("(prefers-color-scheme: dark)").matches if ((prefersDarkScheme && currentTheme === "light") || (!prefersDarkScheme && currentTheme === "dark")) { document.documentElement.dataset.theme = currentTheme } } </script> <meta charset='utf-8'> <meta content='IE=edge,chrome=1' http-equiv='X-UA-Compatible'> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Git - git-ls-files Documentation</title> <link href="/favicon.ico" rel='shortcut icon' type='image/x-icon'> <link rel="stylesheet" href="/application.min.css"> </head> <body id="documentation"> <div class="inner"> <header> <a id="logo" href="/"><img src="/images/logo@2x.png" width="110" height="46" alt="Git" class="no-filter" /></a> <span id="tagline"></span> <script type="text/javascript"> const taglines = [ "fast-version-control", "everything-is-local", "distributed-even-if-your-workflow-isnt", "local-branching-on-the-cheap", "distributed-is-the-new-centralized" ]; var tagline = taglines[Math.floor(Math.random() * taglines.length)]; document.getElementById('tagline').innerHTML = '--' + tagline; </script> <div id="search-container"> <form id="search" action="/search/results"> <input id="search-text" name="search" placeholder="Type / to search entire site…" autocomplete="off" type="text" /> </form> <div id="search-results"></div> </div> <img src="/images/dark-mode.svg" id="dark-mode-button" /> </header> </div> <div class="inner"> <div id="content-wrapper"> <div tabindex="1" class="sidebar-btn"></div> <aside class="sidebar" id="sidebar"> <nav> <ul> <li> <a href="/about">About</a> <ul> </ul> </li> <li> <a href="/doc" class="active">Documentation</a> <ul class="expanded"> <li> <a href="/docs" class="active">Reference</a> </li> <li> <a href="/book">Book</a> </li> <li> <a href="/videos">Videos</a> </li> <li> <a href="/doc/ext">External Links</a> </li> </ul> </li> <li> <a href="/downloads">Downloads</a> <ul > <li> <a href="/downloads/guis">GUI Clients</a> </li> <li> <a href="/downloads/logos">Logos</a> </li> </ul> </li> <li> <a href="/community">Community</a> </li> </ul> </nav> </aside> <div id="content"> <div id='reference-version'> <a class="dropdown-trigger" id="reference-languages-trigger" data-panel-id="l10n-versions-dropdown" href="#"> English ▾</a> <div class='dropdown-panel right' id='l10n-versions-dropdown'> <header>Localized versions of <strong>git-ls-files</strong> manual</header> <ol class='reference-previous-versions'> <li> <a href="/docs/git-ls-files"><span class="version">English</span> </a> </li> <li> <a href="/docs/git-ls-files/pt_BR"><span class="version">Português (Brasil)</span> </a> </li> <li> <a href="/docs/git-ls-files/zh_HANS-CN"><span class="version">简体中文</span> </a> </li> </ol> <footer> Want to read in your language or fix typos?<br/> <a href="https://github.com/jnavila/git-manpages-l10n">You can help translate this page</a>. </footer> </div> <a class="dropdown-trigger" id="reference-topics-trigger" data-panel-id="topics-dropdown" href="#">Topics ▾</a> <div class='dropdown-panel right' id='topics-dropdown'> <div class='three-column'> <div class='column-left'> <h3 class='setup'>Setup and Config</h3> <ul class='unstyled'> <li> <a href="/docs/git"> git </a> </li> <li> <a href="/docs/git-config"> config </a> </li> <li> <a href="/docs/git-help"> help </a> </li> <li> <a href="/docs/git-bugreport"> bugreport </a> </li> <li> <a href="/doc/credential-helpers"> Credential helpers </a> </li> </ul> <h3 class='projects'>Getting and Creating Projects</h3> <ul class='unstyled'> <li> <a href="/docs/git-init"> init </a> </li> <li> <a href="/docs/git-clone"> clone </a> </li> </ul> <h3 class='snapshotting'>Basic Snapshotting</h3> <ul class='unstyled'> <li> <a href="/docs/git-add"> add </a> </li> <li> <a href="/docs/git-status"> status </a> </li> <li> <a href="/docs/git-diff"> diff </a> </li> <li> <a href="/docs/git-commit"> commit </a> </li> <li> <a href="/docs/git-notes"> notes </a> </li> <li> <a href="/docs/git-restore"> restore </a> </li> <li> <a href="/docs/git-reset"> reset </a> </li> <li> <a href="/docs/git-rm"> rm </a> </li> <li> <a href="/docs/git-mv"> mv </a> </li> </ul> <h3 class='branching'>Branching and Merging</h3> <ul class='unstyled'> <li> <a href="/docs/git-branch"> branch </a> </li> <li> <a href="/docs/git-checkout"> checkout </a> </li> <li> <a href="/docs/git-switch"> switch </a> </li> <li> <a href="/docs/git-merge"> merge </a> </li> <li> <a href="/docs/git-mergetool"> mergetool </a> </li> <li> <a href="/docs/git-log"> log </a> </li> <li> <a href="/docs/git-stash"> stash </a> </li> <li> <a href="/docs/git-tag"> tag </a> </li> <li> <a href="/docs/git-worktree"> worktree </a> </li> </ul> <h3 class='sharing'>Sharing and Updating Projects</h3> <ul class='unstyled'> <li> <a href="/docs/git-fetch"> fetch </a> </li> <li> <a href="/docs/git-pull"> pull </a> </li> <li> <a href="/docs/git-push"> push </a> </li> <li> <a href="/docs/git-remote"> remote </a> </li> <li> <a href="/docs/git-submodule"> submodule </a> </li> </ul> </div> <div class='column-middle'> <h3 class='inspection'>Inspection and Comparison</h3> <ul class='unstyled'> <li> <a href="/docs/git-show"> show </a> </li> <li> <a href="/docs/git-log"> log </a> </li> <li> <a href="/docs/git-diff"> diff </a> </li> <li> <a href="/docs/git-difftool"> difftool </a> </li> <li> <a href="/docs/git-range-diff"> range-diff </a> </li> <li> <a href="/docs/git-shortlog"> shortlog </a> </li> <li> <a href="/docs/git-describe"> describe </a> </li> </ul> <h3 class='patching'>Patching</h3> <ul class='unstyled'> <li> <a href="/docs/git-apply"> apply </a> </li> <li> <a href="/docs/git-cherry-pick"> cherry-pick </a> </li> <li> <a href="/docs/git-diff"> diff </a> </li> <li> <a href="/docs/git-rebase"> rebase </a> </li> <li> <a href="/docs/git-revert"> revert </a> </li> </ul> <h3 class='debugging'>Debugging</h3> <ul class='unstyled'> <li> <a href="/docs/git-bisect"> bisect </a> </li> <li> <a href="/docs/git-blame"> blame </a> </li> <li> <a href="/docs/git-grep"> grep </a> </li> </ul> <h3 class='email'>Email</h3> <ul class='unstyled'> <li> <a href="/docs/git-am"> am </a> </li> <li> <a href="/docs/git-apply"> apply </a> </li> <li> <a href="/docs/git-format-patch"> format-patch </a> </li> <li> <a href="/docs/git-send-email"> send-email </a> </li> <li> <a href="/docs/git-request-pull"> request-pull </a> </li> </ul> <h3 class='external'>External Systems</h3> <ul class='unstyled'> <li> <a href="/docs/git-svn"> svn </a> </li> <li> <a href="/docs/git-fast-import"> fast-import </a> </li> </ul> <h3 class='server-admin'>Server Admin</h3> <ul class='unstyled'> <li> <a href="/docs/git-daemon"> daemon </a> </li> <li> <a href="/docs/git-update-server-info"> update-server-info </a> </li> </ul> </div> <div class='column-right'> <h3 class='guides'>Guides</h3> <ul class='unstyled'> <li> <a href="/docs/gitattributes"> gitattributes </a> </li> <li> <a href="/docs/gitcli"> Command-line interface conventions </a> </li> <li> <a href="/docs/giteveryday"> Everyday Git </a> </li> <li> <a href="/docs/gitfaq"> Frequently Asked Questions (FAQ) </a> </li> <li> <a href="/docs/gitglossary"> Glossary </a> </li> <li> <a href="/docs/githooks"> Hooks </a> </li> <li> <a href="/docs/gitignore"> gitignore </a> </li> <li> <a href="/docs/gitmodules"> gitmodules </a> </li> <li> <a href="/docs/gitrevisions"> Revisions </a> </li> <li> <a href="/docs/gitsubmodules"> Submodules </a> </li> <li> <a href="/docs/gittutorial"> Tutorial </a> </li> <li> <a href="/docs/gitworkflows"> Workflows </a> </li> <li> <a href="/docs/git#_guides"> All guides... </a> </li> </ul> <h3 class='admin'>Administration</h3> <ul class='unstyled'> <li> <a href="/docs/git-clean"> clean </a> </li> <li> <a href="/docs/git-gc"> gc </a> </li> <li> <a href="/docs/git-fsck"> fsck </a> </li> <li> <a href="/docs/git-reflog"> reflog </a> </li> <li> <a href="/docs/git-filter-branch"> filter-branch </a> </li> <li> <a href="/docs/git-instaweb"> instaweb </a> </li> <li> <a href="/docs/git-archive"> archive </a> </li> <li> <a href="/docs/git-bundle"> bundle </a> </li> </ul> <h3 class='plumbing'>Plumbing Commands</h3> <ul class='unstyled'> <li> <a href="/docs/git-cat-file"> cat-file </a> </li> <li> <a href="/docs/git-check-ignore"> check-ignore </a> </li> <li> <a href="/docs/git-checkout-index"> checkout-index </a> </li> <li> <a href="/docs/git-commit-tree"> commit-tree </a> </li> <li> <a href="/docs/git-count-objects"> count-objects </a> </li> <li> <a href="/docs/git-diff-index"> diff-index </a> </li> <li> <a href="/docs/git-for-each-ref"> for-each-ref </a> </li> <li> <a href="/docs/git-hash-object"> hash-object </a> </li> <li> <a href="/docs/git-ls-files"> ls-files </a> </li> <li> <a href="/docs/git-ls-tree"> ls-tree </a> </li> <li> <a href="/docs/git-merge-base"> merge-base </a> </li> <li> <a href="/docs/git-read-tree"> read-tree </a> </li> <li> <a href="/docs/git-rev-list"> rev-list </a> </li> <li> <a href="/docs/git-rev-parse"> rev-parse </a> </li> <li> <a href="/docs/git-show-ref"> show-ref </a> </li> <li> <a href="/docs/git-symbolic-ref"> symbolic-ref </a> </li> <li> <a href="/docs/git-update-index"> update-index </a> </li> <li> <a href="/docs/git-update-ref"> update-ref </a> </li> <li> <a href="/docs/git-verify-pack"> verify-pack </a> </li> <li> <a href="/docs/git-write-tree"> write-tree </a> </li> </ul> </div> </div> </div> <a class="dropdown-trigger" id="reference-versions-trigger" data-panel-id="previous-versions-dropdown" href="#"> Version 2.30.1 ▾ </a> <span class="light d-flex">git-ls-files last updated in 2.46.1</span> <div class='dropdown-panel left' id='previous-versions-dropdown'> <header>Changes in the <strong>git-ls-files</strong> manual</header> <ol class='reference-previous-versions'> <li class="no-change"><span>2.46.2 &rarr; 2.49.0 no changes</span></li> <li> <a href="/docs/git-ls-files/2.46.1"><span class="version">2.46.1</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2024-09-13</em> </a> </li> <li class="no-change"><span>2.44.1 &rarr; 2.46.0 no changes</span></li> <li> <a href="/docs/git-ls-files/2.44.0"><span class="version">2.44.0</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2024-02-23</em> </a> </li> <li class="no-change"><span>2.43.1 &rarr; 2.43.6 no changes</span></li> <li> <a href="/docs/git-ls-files/2.43.0"><span class="version">2.43.0</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2023-11-20</em> </a> </li> <li class="no-change"><span>2.42.1 &rarr; 2.42.4 no changes</span></li> <li> <a href="/docs/git-ls-files/2.42.0"><span class="version">2.42.0</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2023-08-21</em> </a> </li> <li class="no-change"><span>2.40.1 &rarr; 2.41.3 no changes</span></li> <li> <a href="/docs/git-ls-files/2.40.0"><span class="version">2.40.0</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2023-03-12</em> </a> </li> <li class="no-change"><span>2.39.1 &rarr; 2.39.5 no changes</span></li> <li> <a href="/docs/git-ls-files/2.39.0"><span class="version">2.39.0</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2022-12-12</em> </a> </li> <li class="no-change"><span>2.38.1 &rarr; 2.38.5 no changes</span></li> <li> <a href="/docs/git-ls-files/2.38.0"><span class="version">2.38.0</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2022-10-02</em> </a> </li> <li class="no-change"><span>2.36.1 &rarr; 2.37.7 no changes</span></li> <li> <a href="/docs/git-ls-files/2.36.0"><span class="version">2.36.0</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2022-04-18</em> </a> </li> <li class="no-change"><span>2.35.1 &rarr; 2.35.8 no changes</span></li> <li> <a href="/docs/git-ls-files/2.35.0"><span class="version">2.35.0</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2022-01-24</em> </a> </li> <li class="no-change"><span>2.31.1 &rarr; 2.34.8 no changes</span></li> <li> <a href="/docs/git-ls-files/2.31.0"><span class="version">2.31.0</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2021-03-15</em> </a> </li> <li class="no-change"><span>2.30.2 &rarr; 2.30.9 no changes</span></li> <li> <a href="/docs/git-ls-files/2.30.1"><span class="version">2.30.1</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2021-02-08</em> </a> </li> <li> <a href="/docs/git-ls-files/2.30.0"><span class="version">2.30.0</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2020-12-27</em> </a> </li> <li class="no-change"><span>2.27.1 &rarr; 2.29.3 no changes</span></li> <li> <a href="/docs/git-ls-files/2.27.0"><span class="version">2.27.0</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2020-06-01</em> </a> </li> <li class="no-change"><span>2.22.1 &rarr; 2.26.3 no changes</span></li> <li> <a href="/docs/git-ls-files/2.22.0"><span class="version">2.22.0</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2019-06-07</em> </a> </li> <li class="no-change"><span>2.18.1 &rarr; 2.21.4 no changes</span></li> <li> <a href="/docs/git-ls-files/2.18.0"><span class="version">2.18.0</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2018-06-21</em> </a> </li> <li class="no-change"><span>2.17.0 &rarr; 2.17.6 no changes</span></li> <li> <a href="/docs/git-ls-files/2.16.6"><span class="version">2.16.6</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2019-12-06</em> </a> </li> <li class="no-change"><span>2.14.6 &rarr; 2.15.4 no changes</span></li> <li> <a href="/docs/git-ls-files/2.13.7"><span class="version">2.13.7</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2018-05-22</em> </a> </li> <li class="no-change"><span>2.12.5 no changes</span></li> <li> <a href="/docs/git-ls-files/2.11.4"><span class="version">2.11.4</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2017-09-22</em> </a> </li> <li> <a href="/docs/git-ls-files/2.10.5"><span class="version">2.10.5</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2017-09-22</em> </a> </li> <li> <a href="/docs/git-ls-files/2.9.5"><span class="version">2.9.5</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2017-07-30</em> </a> </li> <li> <a href="/docs/git-ls-files/2.8.6"><span class="version">2.8.6</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2017-07-30</em> </a> </li> <li class="no-change"><span>2.2.3 &rarr; 2.7.6 no changes</span></li> <li> <a href="/docs/git-ls-files/2.1.4"><span class="version">2.1.4</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2014-12-17</em> </a> </li> <li> <a href="/docs/git-ls-files/2.0.5"><span class="version">2.0.5</span> <span class="diff"> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/green-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/red-dot.png" /> <img src="/images/icons/grey-dot.png" /> <img src="/images/icons/grey-dot.png" /> </span> <em class="date">2014-12-17</em> </a> </li> <li>&nbsp;</li> </ol> <footer> <p>Check your version of git by running</p> <code class="command">git --version</code> </footer> </div> </div> <div id="main"> <div class="sect1"> <h2 id="_name"><a class="anchor" href="#_name"></a>NAME</h2> <div class="sectionbody"> <div class="paragraph"> <p>git-ls-files - Show information about files in the index and the working tree</p> </div> </div> </div> <div class="sect1"> <h2 id="_synopsis"><a class="anchor" href="#_synopsis"></a>SYNOPSIS</h2> <div class="sectionbody"> <div class="verseblock"> <pre class="content"><em>git ls-files</em> [-z] [-t] [-v] [-f] (--[cached|deleted|others|ignored|stage|unmerged|killed|modified])* (-[c|d|o|i|s|u|k|m])* [--eol] [-x &lt;pattern&gt;|--exclude=&lt;pattern&gt;] [-X &lt;file&gt;|--exclude-from=&lt;file&gt;] [--exclude-per-directory=&lt;file&gt;] [--exclude-standard] [--error-unmatch] [--with-tree=&lt;tree-ish&gt;] [--full-name] [--recurse-submodules] [--abbrev[=&lt;n&gt;]] [--] [&lt;file&gt;&#8230;&#8203;]</pre> </div> </div> </div> <div class="sect1"> <h2 id="_description"><a class="anchor" href="#_description"></a>DESCRIPTION</h2> <div class="sectionbody"> <div class="paragraph"> <p>This merges the file listing in the index with the actual working directory list, and shows different combinations of the two.</p> </div> <div class="paragraph"> <p>One or more of the options below may be used to determine the files shown:</p> </div> </div> </div> <div class="sect1"> <h2 id="_options"><a class="anchor" href="#_options"></a>OPTIONS</h2> <div class="sectionbody"> <div class="dlist"> <dl> <dt class="hdlist1" id="Documentation/git-ls-files.txt--c"> <a class="anchor" href="#Documentation/git-ls-files.txt--c"></a>-c </dt> <dt class="hdlist1" id="Documentation/git-ls-files.txt---cached"> <a class="anchor" href="#Documentation/git-ls-files.txt---cached"></a>--cached </dt> <dd> <p>Show cached files in the output (default)</p> </dd> <dt class="hdlist1" id="Documentation/git-ls-files.txt--d"> <a class="anchor" href="#Documentation/git-ls-files.txt--d"></a>-d </dt> <dt class="hdlist1" id="Documentation/git-ls-files.txt---deleted"> <a class="anchor" href="#Documentation/git-ls-files.txt---deleted"></a>--deleted </dt> <dd> <p>Show deleted files in the output</p> </dd> <dt class="hdlist1" id="Documentation/git-ls-files.txt--m"> <a class="anchor" href="#Documentation/git-ls-files.txt--m"></a>-m </dt> <dt class="hdlist1" id="Documentation/git-ls-files.txt---modified"> <a class="anchor" href="#Documentation/git-ls-files.txt---modified"></a>--modified </dt> <dd> <p>Show modified files in the output</p> </dd> <dt class="hdlist1" id="Documentation/git-ls-files.txt--o"> <a class="anchor" href="#Documentation/git-ls-files.txt--o"></a>-o </dt> <dt class="hdlist1" id="Documentation/git-ls-files.txt---others"> <a class="anchor" href="#Documentation/git-ls-files.txt---others"></a>--others </dt> <dd> <p>Show other (i.e. untracked) files in the output</p> </dd> <dt class="hdlist1" id="Documentation/git-ls-files.txt--i"> <a class="anchor" href="#Documentation/git-ls-files.txt--i"></a>-i </dt> <dt class="hdlist1" id="Documentation/git-ls-files.txt---ignored"> <a class="anchor" href="#Documentation/git-ls-files.txt---ignored"></a>--ignored </dt> <dd> <p>Show only ignored files in the output. When showing files in the index, print only those matched by an exclude pattern. When showing "other" files, show only those matched by an exclude pattern. Standard ignore rules are not automatically activated, therefore at least one of the <code>--exclude*</code> options is required.</p> </dd> <dt class="hdlist1" id="Documentation/git-ls-files.txt--s"> <a class="anchor" href="#Documentation/git-ls-files.txt--s"></a>-s </dt> <dt class="hdlist1" id="Documentation/git-ls-files.txt---stage"> <a class="anchor" href="#Documentation/git-ls-files.txt---stage"></a>--stage </dt> <dd> <p>Show staged contents' mode bits, object name and stage number in the output.</p> </dd> <dt class="hdlist1" id="Documentation/git-ls-files.txt---directory"> <a class="anchor" href="#Documentation/git-ls-files.txt---directory"></a>--directory </dt> <dd> <p>If a whole directory is classified as "other", show just its name (with a trailing slash) and not its whole contents.</p> </dd> <dt class="hdlist1" id="Documentation/git-ls-files.txt---no-empty-directory"> <a class="anchor" href="#Documentation/git-ls-files.txt---no-empty-directory"></a>--no-empty-directory </dt> <dd> <p>Do not list empty directories. Has no effect without --directory.</p> </dd> <dt class="hdlist1" id="Documentation/git-ls-files.txt--u"> <a class="anchor" href="#Documentation/git-ls-files.txt--u"></a>-u </dt> <dt class="hdlist1" id="Documentation/git-ls-files.txt---unmerged"> <a class="anchor" href="#Documentation/git-ls-files.txt---unmerged"></a>--unmerged </dt> <dd> <p>Show unmerged files in the output (forces --stage)</p> </dd> <dt class="hdlist1" id="Documentation/git-ls-files.txt--k"> <a class="anchor" href="#Documentation/git-ls-files.txt--k"></a>-k </dt> <dt class="hdlist1" id="Documentation/git-ls-files.txt---killed"> <a class="anchor" href="#Documentation/git-ls-files.txt---killed"></a>--killed </dt> <dd> <p>Show files on the filesystem that need to be removed due to file/directory conflicts for checkout-index to succeed.</p> </dd> <dt class="hdlist1" id="Documentation/git-ls-files.txt--z"> <a class="anchor" href="#Documentation/git-ls-files.txt--z"></a>-z </dt> <dd> <p>\0 line termination on output and do not quote filenames. See OUTPUT below for more information.</p> </dd> <dt class="hdlist1" id="Documentation/git-ls-files.txt--xltpatterngt"> <a class="anchor" href="#Documentation/git-ls-files.txt--xltpatterngt"></a>-x &lt;pattern&gt; </dt> <dt class="hdlist1" id="Documentation/git-ls-files.txt---excludeltpatterngt"> <a class="anchor" href="#Documentation/git-ls-files.txt---excludeltpatterngt"></a>--exclude=&lt;pattern&gt; </dt> <dd> <p>Skip untracked files matching pattern. Note that pattern is a shell wildcard pattern. See EXCLUDE PATTERNS below for more information.</p> </dd> <dt class="hdlist1" id="Documentation/git-ls-files.txt--Xltfilegt"> <a class="anchor" href="#Documentation/git-ls-files.txt--Xltfilegt"></a>-X &lt;file&gt; </dt> <dt class="hdlist1" id="Documentation/git-ls-files.txt---exclude-fromltfilegt"> <a class="anchor" href="#Documentation/git-ls-files.txt---exclude-fromltfilegt"></a>--exclude-from=&lt;file&gt; </dt> <dd> <p>Read exclude patterns from &lt;file&gt;; 1 per line.</p> </dd> <dt class="hdlist1" id="Documentation/git-ls-files.txt---exclude-per-directoryltfilegt"> <a class="anchor" href="#Documentation/git-ls-files.txt---exclude-per-directoryltfilegt"></a>--exclude-per-directory=&lt;file&gt; </dt> <dd> <p>Read additional exclude patterns that apply only to the directory and its subdirectories in &lt;file&gt;.</p> </dd> <dt class="hdlist1" id="Documentation/git-ls-files.txt---exclude-standard"> <a class="anchor" href="#Documentation/git-ls-files.txt---exclude-standard"></a>--exclude-standard </dt> <dd> <p>Add the standard Git exclusions: .git/info/exclude, .gitignore in each directory, and the user&#8217;s global exclusion file.</p> </dd> <dt class="hdlist1" id="Documentation/git-ls-files.txt---error-unmatch"> <a class="anchor" href="#Documentation/git-ls-files.txt---error-unmatch"></a>--error-unmatch </dt> <dd> <p>If any &lt;file&gt; does not appear in the index, treat this as an error (return 1).</p> </dd> <dt class="hdlist1" id="Documentation/git-ls-files.txt---with-treelttree-ishgt"> <a class="anchor" href="#Documentation/git-ls-files.txt---with-treelttree-ishgt"></a>--with-tree=&lt;tree-ish&gt; </dt> <dd> <p>When using --error-unmatch to expand the user supplied &lt;file&gt; (i.e. path pattern) arguments to paths, pretend that paths which were removed in the index since the named &lt;tree-ish&gt; are still present. Using this option with <code>-s</code> or <code>-u</code> options does not make any sense.</p> </dd> <dt class="hdlist1" id="Documentation/git-ls-files.txt--t"> <a class="anchor" href="#Documentation/git-ls-files.txt--t"></a>-t </dt> <dd> <p>This feature is semi-deprecated. For scripting purpose, <a href='/docs/git-status'>git-status[1]</a> <code>--porcelain</code> and <a href='/docs/git-diff-files'>git-diff-files[1]</a> <code>--name-status</code> are almost always superior alternatives, and users should look at <a href='/docs/git-status'>git-status[1]</a> <code>--short</code> or <a href='/docs/git-diff'>git-diff[1]</a> <code>--name-status</code> for more user-friendly alternatives.</p> <div class="openblock"> <div class="content"> <div class="paragraph"> <p>This option identifies the file status with the following tags (followed by a space) at the start of each line:</p> </div> <div class="dlist"> <dl> <dt class="hdlist1" id="Documentation/git-ls-files.txt-H"> <a class="anchor" href="#Documentation/git-ls-files.txt-H"></a>H </dt> <dd> <p>cached</p> </dd> <dt class="hdlist1" id="Documentation/git-ls-files.txt-S"> <a class="anchor" href="#Documentation/git-ls-files.txt-S"></a>S </dt> <dd> <p>skip-worktree</p> </dd> <dt class="hdlist1" id="Documentation/git-ls-files.txt-M"> <a class="anchor" href="#Documentation/git-ls-files.txt-M"></a>M </dt> <dd> <p>unmerged</p> </dd> <dt class="hdlist1" id="Documentation/git-ls-files.txt-R"> <a class="anchor" href="#Documentation/git-ls-files.txt-R"></a>R </dt> <dd> <p>removed/deleted</p> </dd> <dt class="hdlist1" id="Documentation/git-ls-files.txt-C"> <a class="anchor" href="#Documentation/git-ls-files.txt-C"></a>C </dt> <dd> <p>modified/changed</p> </dd> <dt class="hdlist1" id="Documentation/git-ls-files.txt-K"> <a class="anchor" href="#Documentation/git-ls-files.txt-K"></a>K </dt> <dd> <p>to be killed</p> </dd> <dt class="hdlist1" id="Documentation/git-ls-files.txt-"> <a class="anchor" href="#Documentation/git-ls-files.txt-"></a>? </dt> <dd> <p>other</p> </dd> </dl> </div> </div> </div> </dd> <dt class="hdlist1" id="Documentation/git-ls-files.txt--v"> <a class="anchor" href="#Documentation/git-ls-files.txt--v"></a>-v </dt> <dd> <p>Similar to <code>-t</code>, but use lowercase letters for files that are marked as <em>assume unchanged</em> (see <a href='/docs/git-update-index'>git-update-index[1]</a>).</p> </dd> <dt class="hdlist1" id="Documentation/git-ls-files.txt--f"> <a class="anchor" href="#Documentation/git-ls-files.txt--f"></a>-f </dt> <dd> <p>Similar to <code>-t</code>, but use lowercase letters for files that are marked as <em>fsmonitor valid</em> (see <a href='/docs/git-update-index'>git-update-index[1]</a>).</p> </dd> <dt class="hdlist1" id="Documentation/git-ls-files.txt---full-name"> <a class="anchor" href="#Documentation/git-ls-files.txt---full-name"></a>--full-name </dt> <dd> <p>When run from a subdirectory, the command usually outputs paths relative to the current directory. This option forces paths to be output relative to the project top directory.</p> </dd> <dt class="hdlist1" id="Documentation/git-ls-files.txt---recurse-submodules"> <a class="anchor" href="#Documentation/git-ls-files.txt---recurse-submodules"></a>--recurse-submodules </dt> <dd> <p>Recursively calls ls-files on each active submodule in the repository. Currently there is only support for the --cached mode.</p> </dd> <dt class="hdlist1" id="Documentation/git-ls-files.txt---abbrevltngt"> <a class="anchor" href="#Documentation/git-ls-files.txt---abbrevltngt"></a>--abbrev[=&lt;n&gt;] </dt> <dd> <p>Instead of showing the full 40-byte hexadecimal object lines, show the shortest prefix that is at least <em>&lt;n&gt;</em> hexdigits long that uniquely refers the object. Non default number of digits can be specified with --abbrev=&lt;n&gt;.</p> </dd> <dt class="hdlist1" id="Documentation/git-ls-files.txt---debug"> <a class="anchor" href="#Documentation/git-ls-files.txt---debug"></a>--debug </dt> <dd> <p>After each line that describes a file, add more data about its cache entry. This is intended to show as much information as possible for manual inspection; the exact format may change at any time.</p> </dd> <dt class="hdlist1" id="Documentation/git-ls-files.txt---eol"> <a class="anchor" href="#Documentation/git-ls-files.txt---eol"></a>--eol </dt> <dd> <p>Show &lt;eolinfo&gt; and &lt;eolattr&gt; of files. &lt;eolinfo&gt; is the file content identification used by Git when the "text" attribute is "auto" (or not set and core.autocrlf is not false). &lt;eolinfo&gt; is either "-text", "none", "lf", "crlf", "mixed" or "".</p> <div class="paragraph"> <p>"" means the file is not a regular file, it is not in the index or not accessible in the working tree.</p> </div> <div class="paragraph"> <p>&lt;eolattr&gt; is the attribute that is used when checking out or committing, it is either "", "-text", "text", "text=auto", "text eol=lf", "text eol=crlf". Since Git 2.10 "text=auto eol=lf" and "text=auto eol=crlf" are supported.</p> </div> <div class="paragraph"> <p>Both the &lt;eolinfo&gt; in the index ("i/&lt;eolinfo&gt;") and in the working tree ("w/&lt;eolinfo&gt;") are shown for regular files, followed by the ("attr/&lt;eolattr&gt;").</p> </div> </dd> <dt class="hdlist1" id="Documentation/git-ls-files.txt---"> <a class="anchor" href="#Documentation/git-ls-files.txt---"></a>-- </dt> <dd> <p>Do not interpret any more arguments as options.</p> </dd> <dt class="hdlist1" id="Documentation/git-ls-files.txt-ltfilegt"> <a class="anchor" href="#Documentation/git-ls-files.txt-ltfilegt"></a>&lt;file&gt; </dt> <dd> <p>Files to show. If no files are given all files which match the other specified criteria are shown.</p> </dd> </dl> </div> </div> </div> <div class="sect1"> <h2 id="_output"><a class="anchor" href="#_output"></a>OUTPUT</h2> <div class="sectionbody"> <div class="paragraph"> <p><em>git ls-files</em> just outputs the filenames unless <code>--stage</code> is specified in which case it outputs:</p> </div> <div class="literalblock"> <div class="content"> <pre>[&lt;tag&gt; ]&lt;mode&gt; &lt;object&gt; &lt;stage&gt; &lt;file&gt;</pre> </div> </div> <div class="paragraph"> <p><em>git ls-files --eol</em> will show i/&lt;eolinfo&gt;&lt;SPACES&gt;w/&lt;eolinfo&gt;&lt;SPACES&gt;attr/&lt;eolattr&gt;&lt;SPACE*&gt;&lt;TAB&gt;&lt;file&gt;</p> </div> <div class="paragraph"> <p><em>git ls-files --unmerged</em> and <em>git ls-files --stage</em> can be used to examine detailed information on unmerged paths.</p> </div> <div class="paragraph"> <p>For an unmerged path, instead of recording a single mode/SHA-1 pair, the index records up to three such pairs; one from tree O in stage 1, A in stage 2, and B in stage 3. This information can be used by the user (or the porcelain) to see what should eventually be recorded at the path. (see <a href='/docs/git-read-tree'>git-read-tree[1]</a> for more information on state)</p> </div> <div class="paragraph"> <p>Without the <code>-z</code> option, pathnames with "unusual" characters are quoted as explained for the configuration variable <code>core.quotePath</code> (see <a href='/docs/git-config'>git-config[1]</a>). Using <code>-z</code> the filename is output verbatim and the line is terminated by a NUL byte.</p> </div> </div> </div> <div class="sect1"> <h2 id="_exclude_patterns"><a class="anchor" href="#_exclude_patterns"></a>EXCLUDE PATTERNS</h2> <div class="sectionbody"> <div class="paragraph"> <p><em>git ls-files</em> can use a list of "exclude patterns" when traversing the directory tree and finding files to show when the flags --others or --ignored are specified. <a href='/docs/gitignore'>gitignore[5]</a> specifies the format of exclude patterns.</p> </div> <div class="paragraph"> <p>These exclude patterns come from these places, in order:</p> </div> <div class="olist arabic"> <ol class="arabic"> <li> <p>The command-line flag --exclude=&lt;pattern&gt; specifies a single pattern. Patterns are ordered in the same order they appear in the command line.</p> </li> <li> <p>The command-line flag --exclude-from=&lt;file&gt; specifies a file containing a list of patterns. Patterns are ordered in the same order they appear in the file.</p> </li> <li> <p>The command-line flag --exclude-per-directory=&lt;name&gt; specifies a name of the file in each directory <em>git ls-files</em> examines, normally <code>.gitignore</code>. Files in deeper directories take precedence. Patterns are ordered in the same order they appear in the files.</p> </li> </ol> </div> <div class="paragraph"> <p>A pattern specified on the command line with --exclude or read from the file specified with --exclude-from is relative to the top of the directory tree. A pattern read from a file specified by --exclude-per-directory is relative to the directory that the pattern file appears in.</p> </div> </div> </div> <div class="sect1"> <h2 id="_see_also"><a class="anchor" href="#_see_also"></a>SEE ALSO</h2> <div class="sectionbody"> <div class="paragraph"> <p><a href='/docs/git-read-tree'>git-read-tree[1]</a>, <a href='/docs/gitignore'>gitignore[5]</a></p> </div> </div> </div> <div class="sect1"> <h2 id="_git"><a class="anchor" href="#_git"></a>GIT</h2> <div class="sectionbody"> <div class="paragraph"> <p>Part of the <a href='/docs/git'>git[1]</a> suite</p> </div> </div> </div> <h3 hidden="true" data-pagefind-weight="7">ls-files</h3> </div> </div> </div> <footer> <div class="site-source"> <a href="/site">About this site</a><br> Patches, suggestions, and comments are welcome. </div> <div class="sfc-member"> Git is a member of <a href="/sfc">Software Freedom Conservancy</a> </div> </footer> <a href="#top" class="no-js scrollToTop" id="scrollToTop" data-label="Scroll to top"> <img src="/images/icons/chevron-up@2x.png" width="20" height="20" alt="scroll-to-top"/> </a> <script src="/js/jquery-1.7.1.min.js"></script> <script src="/js/jquery-ui-1.8.18.custom.min.js"></script> <script src="/js/jquery.defaultvalue.js"></script> <script src="/js/session.min.js"></script> <script src="/js/modernizr.js"></script> <script src="/js/modernize.js"></script> <script src="/js/application.min.js"></script> </div> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10