Skip to contentSkip to conversation

init: support --import to add all files and commit right after init

PATCH In review Nguyễn Thái Ngọc Duy 2 participants 2 messages Jun 15, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 init: support --import to add all files and commit right after init

This is equivalent to "git init;git add .;git commit -q -m blah". I find myself doing that too many times, hence this shortcut.

In future, --fast-import support would also be nice if the import directory has a lot of files.

---

Quoted 5 lines
Quoted 2 lines
+-m::
+--import[=<message>]::

Nit: -m made sense when it specified a message. But now that it doesn't take a message, maybe "-i" would be more appropriate?

Makes sense.

 Documentation/git-init.txt |   18 +++++++++++++++++-
 builtin-init-db.c          |   44 ++++++++++++++++++++++++++++++++++++++++----
 t/t0001-init.sh            |   44 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 101 insertions(+), 5 deletions(-)
Documentation/git-init.txt +17 -1
index 71749c0..1df07c2 100644
@@ -8,7 +8,8 @@ git-init - Create an empty git repository or reinitialize an existing one
 
 SYNOPSIS
 --------
-'git init' [-q | --quiet] [--bare] [--template=<template_directory>] [--shared[=<permissions>]]
+'git init' [-q | --quiet] [--bare] [--template=<template_directory>]
+           [--shared[=<permissions>]] [-i | --import[=<message>]]
 
 
 OPTIONS
@@ -68,6 +69,21 @@ By default, the configuration flag receive.denyNonFastForwards is enabled
 in shared repositories, so that you cannot force a non fast-forwarding push
 into it.
 
+-i::
+--import[=<message>]::
+
+Commit everything to the newly initialized repository. This is equivalent to:
+
+----------------
+$ git init
+$ git add .
+$ git commit -q -m <message>
+----------------
+
+If `-i` is used or no message is given to `--import`, "Initial commit" will be
+used as the commit message.
+This option does not work with `--bare` nor already initialized repository.
+
 --
 
 
builtin-init-db.c +40 -4

91 lines not on this page · raw message

t/t0001-init.sh +44 -0

48 lines not on this page · raw message

Signature · 1 line
1.6.1.446.gc7851
#1 lore raw
Quoted 7 lines · Nguyễn Thái Ngọc Duy

This is equivalent to "git init;git add .;git commit -q -m blah". I find myself doing that too many times, hence this shortcut.

In future, --fast-import support would also be nice if the import directory has a lot of files.

This version looks good to me. Thanks.

-Peff