{"thread":{"id":"58130","subject":"Suggestion for 'git add' CLI","startedAt":"2022-07-11T08:01:16Z","lastAt":"2022-07-11T19:31:14Z","messageCount":2,"participants":["me@alirezaarabi.com","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"458755","messageId":"84b593cf1bacc4541a7a4ca24a5e98fa@alirezaarabi.com","threadId":"58130","inReplyTo":null,"subject":"Suggestion for 'git add' CLI","fromName":"","fromEmail":"me@alirezaarabi.com","sentAt":"2022-07-11T06:58:21Z","receivedAt":"2022-07-11T08:01:16Z","isPatch":false,"sender":{"key":"me@alirezaarabi.com","avatar":null},"body":"hi there, I have a suggestion about git CLI.when I use 'git add -A' or \n'git add --all' it stages all of my files but when I use git add \n<file_name> it adds the file name to the stage, not all files. but when \nI use ' git add <file_name> --all ' it also works and adds all the files \nto the stage. I think it's better to provide a warning for this \nsituation. thank you.\n"},{"id":"458812","messageId":"xmqqsfn7o39i.fsf@gitster.g","threadId":"58130","inReplyTo":"84b593cf1bacc4541a7a4ca24a5e98fa@alirezaarabi.com","subject":"Re: Suggestion for 'git add' CLI","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-07-11T19:31:05Z","receivedAt":"2022-07-11T19:31:14Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"me@alirezaarabi.com writes:\n\n> hi there, I have a suggestion about git CLI.when I use 'git add -A' or\n> 'git add --all' it stages all of my files but when I use git add \n> <file_name> it adds the file name to the stage, not all files. but\n> when I use ' git add <file_name> --all ' it also works and adds all\n> the files to the stage. I think it's better to provide a warning for\n> this situation. thank you.\n\nIf \"git add -A Documentation/\" silently ignores the pathspec and\ndoes not limit the application of \"-A\" to the Documentation\ndirectory, then I think that is a bug worth fixing.\n\n    $ git init trash && cd trash\n    $ mkdir t s\n    $ >t/1 && >s/2\n    $ git add -A t\n    $ git ls-files\n    t/1\n\nIt does seem to honor the pathspec \"t\" and refrains from adding s/2\nto the index, so I do not think there is anything to fix here,\nthough.\n\nBy the way, on the command line of \"git\", dashed command options\ncome before the non-dashed command line arguments, so make it a\nhabit to spell \"git --add <file_name>\".\n\n\n"}]}