Skip to content

Instantly share code, notes, and snippets.

@hegge
Forked from anonymous/gist:9663368
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hegge/9663373 to your computer and use it in GitHub Desktop.
Save hegge/9663373 to your computer and use it in GitHub Desktop.
$ git --version
git version 1.8.5.rc2.7.g8167612 # same behavour with 1.9.1.423.g4596e3a
$ 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 <hegge@resisty.net>
Date: Thu Mar 20 13:55:02 2014 +0100
3
$ 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