# [PATCH] Add a built-in alias for 'stage' to the 'add' command

4 messages from 2008-12-02 to 2008-12-03. Participants: Scott Chacon, Nguyen Thai Ngoc Duy, Junio C Hamano.
Thread: https://gitlist.dev/t/16551

## Scott Chacon, 2008-12-02 06:14

Subject: [PATCH] Add a built-in alias for 'stage' to the 'add' command
Message-ID: <20081202061455.GA48848@agadorsparticus>
URL: https://gitlist.dev/e/20081202061455.GA48848%40agadorsparticus

```
This comes from conversation at the GitTogether where we thought it would
be helpful to be able to teach people to 'stage' files because it tends
to cause confusion when told that they have to keep 'add'ing them.

This continues the movement to start referring to the index as a
staging area (eg: the --staged alias to 'git diff'). Also adds a
doc file for 'git stage' that basically points to the docs for
'git add'.

Signed-off-by: Scott Chacon <schacon@gmail.com>
---

I changed the tense of a few things in the commit message and modified 
the help file to be simpler.

 Documentation/git-stage.txt |   19 +++++++++++++++++++
 git.c                       |    1 +
 2 files changed, 20 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/git-stage.txt

diff --git a/Documentation/git-stage.txt b/Documentation/git-stage.txt
new file mode 100644
index 0000000..7f251a5
--- /dev/null
+++ b/Documentation/git-stage.txt
@@ -0,0 +1,19 @@
+git-stage(1)
+==============
+
+NAME
+----
+git-stage - Add file contents to the staging area
+
+
+SYNOPSIS
+--------
+[verse]
+'git stage' args...
+
+
+DESCRIPTION
+-----------
+
+This is a synonym for linkgit:git-add[1].  Please refer to the
+documentation of that command.
diff --git a/git.c b/git.c
index 89feb0b..9e5813c 100644
--- a/git.c
+++ b/git.c
@@ -266,6 +266,7 @@ static void handle_internal_command(int argc, const char **argv)
 	const char *cmd = argv[0];
 	static struct cmd_struct commands[] = {
 		{ "add", cmd_add, RUN_SETUP | NEED_WORK_TREE },
+		{ "stage", cmd_add, RUN_SETUP | NEED_WORK_TREE },
 		{ "annotate", cmd_annotate, RUN_SETUP },
 		{ "apply", cmd_apply },
 		{ "archive", cmd_archive },
-- 
1.6.0.8.gc9c8

```

## Nguyen Thai Ngoc Duy, 2008-12-02 12:36

Subject: Re: [PATCH] Add a built-in alias for 'stage' to the 'add' command
Message-ID: <fcaeb9bf0812020436n69a21c96g4c13976e493372d9@mail.gmail.com>
URL: https://gitlist.dev/e/fcaeb9bf0812020436n69a21c96g4c13976e493372d9%40mail.gmail.com
In-Reply-To: <20081202061455.GA48848@agadorsparticus>

```
On 12/2/08, Scott Chacon <schacon@gmail.com> wrote:
>  diff --git a/git.c b/git.c
>  index 89feb0b..9e5813c 100644
>  --- a/git.c
>  +++ b/git.c
>  @@ -266,6 +266,7 @@ static void handle_internal_command(int argc, const char **argv)
>         const char *cmd = argv[0];
>         static struct cmd_struct commands[] = {
>                 { "add", cmd_add, RUN_SETUP | NEED_WORK_TREE },
>  +               { "stage", cmd_add, RUN_SETUP | NEED_WORK_TREE },
>                 { "annotate", cmd_annotate, RUN_SETUP },
>                 { "apply", cmd_apply },
>                 { "archive", cmd_archive },

Nit-picking. There are some references to "git add" in builtin-add.c,
like help usage or error message ("Maybe you wanted to say 'git add
.'?\n"). Should it refer to "git stage" instead as well?
-- 
Duy

```

## Junio C Hamano, 2008-12-03 02:18

Subject: Re: [PATCH] Add a built-in alias for 'stage' to the 'add' command
Message-ID: <7vskp6huhg.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vskp6huhg.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <20081202061455.GA48848@agadorsparticus>

```
Thanks.

```

## Junio C Hamano, 2008-12-03 02:18

Subject: Re: [PATCH] Add a built-in alias for 'stage' to the 'add' command
Message-ID: <7vmyfehuha.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vmyfehuha.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <fcaeb9bf0812020436n69a21c96g4c13976e493372d9@mail.gmail.com>

```
"Nguyen Thai Ngoc Duy" <pclouds@gmail.com> writes:

> On 12/2/08, Scott Chacon <schacon@gmail.com> wrote:
>>  diff --git a/git.c b/git.c
>>  index 89feb0b..9e5813c 100644
>>  --- a/git.c
>>  +++ b/git.c
>>  @@ -266,6 +266,7 @@ static void handle_internal_command(int argc, const char **argv)
>>         const char *cmd = argv[0];
>>         static struct cmd_struct commands[] = {
>>                 { "add", cmd_add, RUN_SETUP | NEED_WORK_TREE },
>>  +               { "stage", cmd_add, RUN_SETUP | NEED_WORK_TREE },
>>                 { "annotate", cmd_annotate, RUN_SETUP },
>>                 { "apply", cmd_apply },
>>                 { "archive", cmd_archive },
>
> Nit-picking. There are some references to "git add" in builtin-add.c,
> like help usage or error message ("Maybe you wanted to say 'git add
> .'?\n"). Should it refer to "git stage" instead as well?

I do not think that is necessary.  As git-stage(1) makes it clear, it is
an alias to "add", not the other way around.

```
