Skip to contentSkip to conversation

added a built-in alias for 'stage' to the 'add' command

PATCH In review Scott Chacon 3 participants 3 messages Jun 15, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 added a built-in alias for 'stage' to the 'add' command

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 added a doc file for 'git stage' that basically points to the docs for 'git add'.

---
 Documentation/git-stage.txt |   21 +++++++++++++++++++++
 git.c                       |    1 +
 2 files changed, 22 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/git-stage.txt
Documentation/git-stage.txt new file +21 -0
new file mode 100644
index 0000000..0640198
@@ -0,0 +1,21 @@
+git-stage(1)
+==============
+
+NAME
+----
+git-stage - Add file contents to the staging area
+
+
+SYNOPSIS
+--------
+[verse]
+'git stage' [-n] [-v] [--force | -f] [--interactive | -i] [--patch | -p]
+	  [--all | [--update | -u]] [--intent-to-add | -N]
+	  [--refresh] [--ignore-errors] [--] <filepattern>...
+
+
+DESCRIPTION
+-----------
+
+This is a synonym for linkgit:git-add[1].  Please refer to the
+documentation of that command.
git.c +1 -0
index 89feb0b..9e5813c 100644
@@ -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 },
Signature · 1 line
1.6.0.8.gc9c8
#1 lore raw
Quoted 8 lines · Scott Chacon

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 added a doc file for 'git stage' that basically points to the docs for 'git add'.

FWIW, I think this is a step in the right direction. Or at least if it's the wrong direction, I don't think we're actually _hurting_ anybody, since we're not changing existing commands.

Out of curiosity, have you had any experiences referring to this as "git stage" (maybe just by setting a per-user alias) with new users?

Documentation/git-stage.txt line 14

Quoted 6 lines
Documentation/git-stage.txt new file +6 -0
+SYNOPSIS
+--------
+[verse]
+'git stage' [-n] [-v] [--force | -f] [--interactive | -i] [--patch | -p]
+	  [--all | [--update | -u]] [--intent-to-add | -N]
+	  [--refresh] [--ignore-errors] [--] <filepattern>...

It seems like this might get stale with respect to git-add(1). Since we're not hiding the fact that this is really an alias for "add", maybe it would be better to just have "git stage [options] [--] <filepattern>" (or maybe even something simpler).

-Peff

#2 lore raw
In reply to Scott Chacon
Quoted 1 line · Scott Chacon

Subject: Re: [PATCH] added a built-in alias for 'stage' to the 'add' command

s/added/Add/;

Write your commit log message in present tense (recall David Brown's talk at GitTogether '08? ;-)

Quoted 1 line

this comes from conversation at the GitTogether where we thought it would

s/this/This/;

Quoted 9 lines

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 added a doc file for 'git stage' that basically points to the docs for 'git add'.

I think this is fine but I'd rather not risk the documentation getting stale over time, so...

Documentation/git-stage.txt line 14

Quoted 6 lines
Documentation/git-stage.txt new file +6 -0
+SYNOPSIS
+--------
+[verse]
+'git stage' [-n] [-v] [--force | -f] [--interactive | -i] [--patch | -p]
+	  [--all | [--update | -u]] [--intent-to-add | -N]
+	  [--refresh] [--ignore-errors] [--] <filepattern>...

...I think this should read something like

	'git stage' args...