Skip to content

Instantly share code, notes, and snippets.

@hegge hegge/gist:9663373 forked from anonymous/gist:9663368
Last active Aug 29, 2015

What would you like to do?
$ git --version
git version 1.8.5.rc2.7.g8167612 # same behavour with
$ git init
Initialized empty Git repository in /home/torstein/tmp/git-empty/.git/
$ echo "f" >file
$ git add file
$ git commit -m 1
[master (root-commit) 2871899] 1
1 file changed, 1 insertion(+)
create mode 100644 file
$ git commit -m 2 # git won't let me create an empty commit
On branch master
nothing to commit, working directory clean
$ git commit -m 2 --allow-empty # unless I give --allow-empty
[master cd018ba] 2
$ echo "b" >file2
$ git add -N .
$ git commit -m 3 # This creates an empty commit, without --allow-empty
[master 2690e42] 3
$ git show
commit 2690e42a7381c80cfcc86caaf5d3f2c60f47ab78 (HEAD, master)
Author: Torstein Hegge <>
Date: Thu Mar 20 13:55:02 2014 +0100
$ git status
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: file2
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: file2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.