{"thread":{"id":"8594","subject":"How to stage a tree with all changes?","startedAt":"2007-06-13T16:22:23Z","lastAt":"2007-06-13T18:40:17Z","messageCount":3,"participants":["David Kastrup","Matthieu Moy","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"44961","messageId":"861wgf964g.fsf@lola.quinscape.zz","threadId":"8594","inReplyTo":null,"subject":"How to stage a tree with all changes?","fromName":"David Kastrup","fromEmail":"dak@gnu.org","sentAt":"2007-06-13T16:22:23Z","receivedAt":"2007-06-13T16:22:23Z","isPatch":false,"sender":{"key":"dak@gnu.org","avatar":"https://avatars.githubusercontent.com/u/52141349?v=4"},"body":"\nSuppose I have a number of changes in a tree: additions, deletions,\nrenames and so on.\n\nHow do I stage and commit all of that?\n\ngit-commit -a\n\nomits new files.\n\ngit-add .\ngit-commit -a\n\nseemingly overlooks deletions.\n\nWhat am I overlooking?  This should be simple, shouldn't it?\n\n-- \nDavid Kastrup\n"},{"id":"44967","messageId":"vpqy7inajib.fsf@bauges.imag.fr","threadId":"8594","inReplyTo":"861wgf964g.fsf@lola.quinscape.zz","subject":"Re: How to stage a tree with all changes?","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2007-06-13T16:47:56Z","receivedAt":"2007-06-13T16:47:56Z","isPatch":false,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"David Kastrup <dak@gnu.org> writes:\n\n> Suppose I have a number of changes in a tree: additions, deletions,\n> renames and so on.\n\nAt commit time, a rename is just an add+delete for git. It'll\ninvestigate renames with heuristics later, when needed.\n\n> How do I stage and commit all of that?\n\nWell, what I usually do is\n\n  $ git status\n\n(nicer with \n[status]\n\tcolor = auto\nin ~/.gitconfig)\n\nand then \"confirm\" one by one the things I actually want to commit.\n\n> git-commit -a\n>\n> omits new files.\n>\n> git-add .\n> git-commit -a\n\nThe -a is not necessary if you just did \"git add .\".\n\n> seemingly overlooks deletions.\n\nIn most cases, you'd have deleted the files with \"rm\", and you could\nhave told git at that time, using \"git rm\" instead. Otherwise,\n\n  $ git-ls-files -z | git-update-index --remove -z --stdin\n\nwill remove deleted files from the index after the fact. But I don't\nknow any porcelain command to do that. Perhaps a \"git rm -u\" could be\na nice dual for \"git add -u\"?\n\n-- \nMatthieu\n"},{"id":"44985","messageId":"20070613184017.GF10941@coredump.intra.peff.net","threadId":"8594","inReplyTo":"861wgf964g.fsf@lola.quinscape.zz","subject":"Re: How to stage a tree with all changes?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-06-13T18:40:17Z","receivedAt":"2007-06-13T18:40:17Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Jun 13, 2007 at 06:22:23PM +0200, David Kastrup wrote:\n\n> git-add .\n> git-commit -a\n> \n> seemingly overlooks deletions.\n\nIt shouldn't. Try this:\n\nmkdir repo && cd repo\ngit init\necho foo >foo\ngit add .\ngit commit -m initial\nrm foo\necho bar >bar\ngit add .\ngit commit -a\n\n'bar' is scheduled for addition, and 'foo' is scheduled for deletion.\nHave you perhaps removed a file, but it's still in the working\ndirectory, and so picked up by your git-add? Can you give us a test\ncase?\n\n> What am I overlooking?  This should be simple, shouldn't it?\n\nYes, it should. :)\n\n-Peff\n"}]}