-
Notifications
You must be signed in to change notification settings - Fork 2
/
git-iec
executable file
·45 lines (36 loc) · 1.37 KB
/
git-iec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#! /bin/sh
# Create an "initial empty commit" in the repository.
#
# Rationale (munged from what I just wrote at https://github.com/Anacode/cvs2git-wrap/commit/aa1ccd8c36 )
#
# * When viewing commit diffs in gitk, there is no diff for the
# initial commit. This in turns means that searches for commit
# "adding/removing string" will not show that commit, even if the
# initial tree contains the string.
#
# * When grafting a new commit tree onto an existing project, it makes
# sense to me for both have a common tree at some point. That point
# it the initial commit.
#
# * To easily distinguish different repositories from each other, or
# match up clones, one property that could be useful is the
# commitid(s) of the set of commits with no parents.
#
# This is something I do not yet use, but plan to try.
#
# Compare
# http://stackoverflow.com/questions/5479823/automatically-commit-an-empty-gitignore-file-after-git-init
# http://kevin.deldycke.com/2010/05/initialize-git-repositories/
SUBDIRECTORY_OK=1
OPTIONS_SPEC="\
git iec
Create an empty initial commit, for a fresh repository.
Fails if run without a Git repository,
or if there are already commits on the current branch.
--
"
. "$(git --exec-path)/git-sh-setup"
if git rev-parse HEAD >/dev/null 2>&1; then
die "$0: There seem to be commits already"
fi
exec git commit --allow-empty -m 'initial empty commit'