Created
March 20, 2014 13:08
-
-
Save anonymous/9663368 to your computer and use it in GitHub Desktop.
git add -N. && git commit -m foo creates empty commits
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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