Question about behaviour of git-checkout --patch option
- From
- Merlin Büge <toni@bluenox07.de>
- Date
- May 25, 2020, 20:11 UTC
- Message-ID
- <20200525221100.31d36d4d.toni@bluenox07.de>
Hi all!
I have a question about the behaviour of the git-checkout --patch/-p option.
I have a small local git repository containing empty and non-empty files. I wanted to replicate it in another directory and did the following:
cd <target_dir> git init git remote add origin <origin_dir> git fetch git branch --track master origin/master git checkout master .
This works like expected, I end up with a 1:1 copy of the original worktree, including empty files. However, if I include the -p option in the last step:
git checkout -p master .
... I correctly get asked for any non-empty files/hunks if I want to apply them - but not for empty ones. It would just display e.g.
diff --git b/emptyfile a/emptyfile new file mode 100644 index 0000000..e69de29
and then skip over it, asking for the next non-empty hunk.
Why does it skip over empty hunks?
Thanks!
-- Merlin Büge