2

In Git 1.x git add . does not include deleted files.But from Git 2.0 will it include?

vijay
  • 493
  • 5
  • 19

1 Answers1

4

You are correct. Reading the changelog for git 2.0.

git add <path> is the same as "git add -A <path>" now, so that "git add dir/" will notice paths you removed from the directory and record the removal.
In older versions of Git, "git add <path>" used to ignore removals.

You can say "git add --ignore-removal <path>" to add only added or modified paths in <path>, if you really want to.

So executing

git add .

will include removed files.

To get the old behaviour of git add pre-2.0

git add --ignore-removal .

executing this will 'exclude' removed files from the add operation.


EDIT: I did some further googling around the topic and found this wonderful answer that expands on what I said.

Peter Reid
  • 5,139
  • 2
  • 37
  • 33