Imagine that everytime I commit files, before I push them, I\'d like to list them to check. How may I do that ?
I tried:
git ls-tree -r --name-only m
Git diff to the rescue on this one. You'll use the --name-only
flag. To get the contents of the current commit, use this command:
#before stage
git diff --name-only
#staged changes before committing
git diff --name-only --cached
#after committing
git diff --name-only HEAD^ HEAD
If you want to see the files that you will be pushing if there is more than one commit, you'll need to specify your current branch head and the head on the remote
git diff --name-only remote/branch branch