Reputation: 8088
Suppose I have a folder data/
with some txt files I want to monitor for changes. I want to run a script and find out what has changed since last commit.
Here is the workflow I have in mind:
Make changes: add, modify or remove files
Stage all the files git add data/
List all the changes git diff --name-only --staged
This should account for three cases:
I need a command to specifically tell me which file since last commited was deleted. So that I can do some stuff in my script before doing a git rm deleted_file.txt
Upvotes: 0
Views: 922
Reputation: 1133
You could use the repository gitk Link.It displays changes in a repo or a selected set of commits.
It supports a few options applicable to the git diff-* commands to control how the changes each commit introduces are shown.
Upvotes: 1
Reputation: 7737
Your can use --diff-filter
to list deleted files only including renaming files. But I think your git diff
will also include the deleted files.
git diff --name-only --staged --diff-filter=D
--diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]]
Select only files that are Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R), have their type (i.e. regular file, symlink, submodule, ...) changed (T), are Unmerged (U), are Unknown (X), or have had their pairing Broken (B). Any combination of the filter characters (including none) can be used. When * (All-or-none) is added to the combination, all paths are selected if there is any file that matches other criteria in the comparison; if there is no file that matches other criteria, nothing is selected.
Upvotes: 1