git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: rm and mv commands: should I use them?

From
Jay Soffian <jaysoffian@gmail.com>
Date
Jan 7, 2008, 03:05 UTC
Message-ID
<76718490801061905k30c1ac86r51a65165d47807d4@mail.gmail.com>
In-Reply-To
<379EDA94-A67B-483A-BC5F-E961DD52AD0C@gmail.com>
On 1/6/08, Jon Hancock <redstarling@gmail.com> wrote:
> Additionally, is there
> a simple procedure with git to say: "I want to version exactly what is
> in my working tree.  If I removed something or added something, just
> handle it".
>From http://www-cs-students.stanford.edu/~blynn/gitmagic/ch05.html#id2553633
is the helpful hint:
$ git-ls-files -d -m -o -z | xargs -0 git-update-index --add --remove
I've got the following aliases in my .gitconfig:

alias.addremove=!git-ls-files -d -m -o -z -X .git/info/exclude -X $(git-config core.excludesfile) --exclude-per-directory=.gitignore | xargs -0 git-update-index --add --remove

alias.ls=!git-ls-files -d -m -o -v -X .git/info/exclude -X $(git-config core.excludesfile) --exclude-per-directory=.gitignore

(In 1.5.4, you can replace the two -X's and the --exclude-per-directory with --exclude-standard.)

j.
Previous: Robin RosenbergNext: David Brown
Message 10 of 11 in “rm and mv commands: should I use them?”
  1. Jon HancockJan 6, 2008
  2. David BrownJan 6, 2008
  3. Brian SwetlandJan 6, 2008
  4. Jeff KingJan 6, 2008
  5. Linus TorvaldsJan 6, 2008
  6. Jeff KingJan 7, 2008
  7. Junio C HamanoJan 7, 2008
  8. Jeff KingJan 7, 2008
  9. Robin RosenbergJan 7, 2008
  10. Jay SoffianJan 7, 2008
  11. David BrownJan 7, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.