Reputation: 11926
I'm looking for a sort of git ls
- a command with output similar to the github repo view - which would ideally output something like this:
$ git ls
uncommitted.txt
folder/ abcd0123 Changed a file in a folder Sat Aug 13 00:01:06 2016 +0200
oldfile.txt abcd3210 Changed an old file Sat Aug 13 00:08:23 2016 +0200
Does something like this exist?
Upvotes: 2
Views: 592
Reputation: 11926
There doesn't seem to be any ready-made git ls
so I went ahead and made one myself:
https://github.com/jnvsor/git-ls
Upvotes: 2
Reputation: 6719
commited_files=$(git ls-tree master --name-only)
uncommited_files=$(git status --porcelain | grep "??" | sed -e 's/^?? //')
list="$commited_files $uncommited_files"
for file in $list; do
echo $(printf "$file: "; git log --pretty=format:'%h %s %ad' -1 $file);
done
This makes a list that is all the files and folders in your active directory. If you want to recursively do this, them just do git ls-tree -r master --name-only
.
You then iterate through each file that you have in your list, and print the log of the last commit for that file.
Upvotes: 2