How can I identify files / directories that have been added or removed in a git declaration?

I need to write a script that gradually tracks files and directories added and removed from the git repository.

I tried using: git log -n1 --pretty = "format:" --name-only

But this only tells me which files were committed. It does not indicate whether it has been added or removed.

Any ideas?

+12
source share
2 answers

You can choose --name-status. How --name-onlyis this actually a git-diff option; git -log accepts them to determine how it will display patches.

git log -n 1 --pretty=oneline --name-status

Or equivalently (minus the log header):

git diff --name-status HEAD^ HEAD

isbadawi, git -whatchanged. git -log diff:

git whatchanged -n 1

, --name-status , , blob, , .

+23

Source: https://habr.com/ru/post/1688520/


All Articles