From mboxrd@z Thu Jan 1 00:00:00 1970 From: Junio C Hamano Subject: [PATCH 3/3] git add ... defaults to "-A" Date: Sat, 9 Mar 2013 00:22:38 -0800 Message-ID: <1362817358-24356-4-git-send-email-gitster@pobox.com> References: <1362817358-24356-1-git-send-email-gitster@pobox.com> To: git@vger.kernel.org X-From: git-owner@vger.kernel.org Sat Mar 09 09:23:34 2013 Return-path: Envelope-to: gcvg-git-2@plane.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UEF3x-00042m-T6 for gcvg-git-2@plane.gmane.org; Sat, 09 Mar 2013 09:23:30 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756631Ab3CIIWz (ORCPT ); Sat, 9 Mar 2013 03:22:55 -0500 Received: from b-pb-sasl-quonix.pobox.com ([208.72.237.35]:48082 "EHLO smtp.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756605Ab3CIIWr (ORCPT ); Sat, 9 Mar 2013 03:22:47 -0500 Received: from smtp.pobox.com (unknown [127.0.0.1]) by b-sasl-quonix.pobox.com (Postfix) with ESMTP id C969B9FBB for ; Sat, 9 Mar 2013 03:22:46 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to :subject:date:message-id:in-reply-to:references; s=sasl; bh=i6sd ddhsJ82dQH9jUGUbJOQL8jE=; b=ZrA/p6LgRH18myL19EVNA+ctTgZU28Sam+vH /f0P2awGWnADH8yXGJNQiIHzH2OGj3Surea7/eqBRVp/PC/iBLR0aTdpLZpARZC7 SpIq16LinQM1RoYb4fVqFMl0La3cyR4DioS99J//Ez7HpO9F1IZWuU5FGjajh1oo 77aHQqY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:subject :date:message-id:in-reply-to:references; q=dns; s=sasl; b=e4a4A0 5eNpuXnReiP1C2q4J+AGNESdkTD92Jh3c6+npCKEoJZPFULcTXM/amN6DDrFzRty 7rqkVaV7ETrnTzbLfzP3YX3gj/xxXVVsCkiP6FL2lZUEZZv+6N65XSnFy2GBeI9Q DPl06QykFxTWqxJb7hgK54CtR1BwETZrAQJ2w= Received: from b-pb-sasl-quonix.pobox.com (unknown [127.0.0.1]) by b-sasl-quonix.pobox.com (Postfix) with ESMTP id BEBAF9FBA for ; Sat, 9 Mar 2013 03:22:46 -0500 (EST) Received: from pobox.com (unknown [98.234.214.94]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by b-sasl-quonix.pobox.com (Postfix) with ESMTPSA id 208F39FB9 for ; Sat, 9 Mar 2013 03:22:46 -0500 (EST) X-Mailer: git-send-email 1.8.2-rc3-203-gc9aaab5 In-Reply-To: <1362817358-24356-1-git-send-email-gitster@pobox.com> X-Pobox-Relay-ID: 8587A116-8892-11E2-8788-26A52E706CDE-77302942!b-pb-sasl-quonix.pobox.com Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: Make "git add ..." notice paths that have been removed from the working tree, i.e. a synonym to "git add -A ...". Given that "git add " is to update the index with the state of the named part of the working tree as a whole, it makes it more intuitive, and also makes it possible to simplify the advice we give while marking the paths the user finished resolving conflicts with. We used to say "to record removal as a resolution, remove the path from the working tree and say 'git rm'; for all other cases, edit the path in the working tree and say 'git add'", but we can now say "update the path in the working tree and say 'git add'" instead. Signed-off-by: Junio C Hamano --- Documentation/git-add.txt | 18 +++++++++++------- builtin/add.c | 33 +++------------------------------ 2 files changed, 14 insertions(+), 37 deletions(-) diff --git a/Documentation/git-add.txt b/Documentation/git-add.txt index 5c501a2..e96fa84 100644 --- a/Documentation/git-add.txt +++ b/Documentation/git-add.txt @@ -53,8 +53,14 @@ OPTIONS Files to add content from. Fileglobs (e.g. `*.c`) can be given to add all matching files. Also a leading directory name (e.g. `dir` to add `dir/file1` - and `dir/file2`) can be given to add all files in the - directory, recursively. + and `dir/file2`) can be given to update the index to + match the current state of the directory as a whole (e.g. + specifying `dir` will record not just a file `dir/file1` + modified in the working tree, a file `dir/file2` added to + the working tree, but also a file `dir/file3` removed from + the working tree. Note that older versions of Git used + to ignore removed files; use `--no-all` option if you want + to add modified or new files but ignore removed ones. -n:: --dry-run:: @@ -127,11 +133,9 @@ of Git, hence the form without should not be used. files that have been removed from the working tree. This option is a no-op when no is used. + -This option is primarily to help the current users of Git, whose -"git add ..." ignores removed files. In future versions -of Git, "git add ..." will be a synonym to "git add -A -..." and "git add --no-all ..." will behave like -today's "git add ...", ignoring removed files. +This option is primarily to help users who are used to older +versions of Git, whose "git add ..." was a synonym +to "git add --no-all ...' will also update the\n" - "index for paths removed from the working tree that match\n" - "the given pathspec. If you want to 'add' only changed\n" - "or newly created paths, say 'git add --no-all ...'" - " instead.")); - if (!take_worktree_changes && addremove_explicit < 0 && argc) - /* - * Turn "git add pathspec..." to "git add -A pathspec..." - * in Git 2.0 but not yet - */ - ; /* addremove = 1; */ + /* Turn "git add pathspec..." to "git add -A pathspec..." */ + addremove = 1; if (!show_only && ignore_missing) die(_("Option --ignore-missing can only be used together with --dry-run")); -- 1.8.2-rc3-203-gc9aaab5