Is there any way to get a list of files that will be committed when I type the following?
git commit -m "my changes"
git status lists too much. I could strip out all the words, but I'd rather not. And I don't want to be told about untracked files.
I've tried
git ls-files -md
but that doesn't show files that have been recently added, but not yet committed.
I'm looking for the same output you'd get from
svn status -q
For example $ svn status -q
A file.py
M dir/database.py
M start.py
Solution. 2.1 git log to display all the commit_id, the first one is the last commit_id, copy it. 2.2 git show commit_id --name-only to display all the files committed in the specified commit_id. 2.3 Undo the last commit with git reset --soft HEAD~1 , move the mistakenly committed files back to the staging area.
If you just want to see the diff without committing, use git diff to see unstaged changes, git diff --cached to see changes staged for commit, or git diff HEAD to see both staged and unstaged changes in your working tree. +1 Yes. git diff . htaccess does what I wanted to achieve.
This is what I was looking for. Thanks to notnoop for the lead I needed. I wanted to post back my solution in case it helps others.
git diff HEAD --name-only
Since I intended to do
git commit -s -F mesage.txt
with the files found in the first line.
My intent is to create a little system that totally ignores the index i.e. that I never need to do git add. (From what I understand, the index is useful when creating patches, which isn't by no means the norm in my workflow.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With