Open rnveach opened 1 year ago
git diff HEAD~1
Please recheck that it works, if so, let's update our configs
Approach above does not work.
Explanation on why it is not working: https://www.reddit.com/r/git/comments/a8oju0/basic_question_does_git_diff_only_show_the/ https://stackoverflow.com/a/857696
Workaround is to use git add --intent-to-add .
so in this case git diff HEAD~0
show new file. But it is sligh effect to user activity, there might be some files user did not plan to add to git at all. Good is that such adding to staging is not full staging, so 'git commit' will not take it.
We suggest to use it and user can decide to use it or not.
@rdiachenko , do you know any git commands trick to have new files patch files?
@rdiachenko , do you know any git commands trick to have new files patch files?
No such a trick. Another option would be to append show.patch
with new unstaged files as an additional step before filter execution: git ls-files -o --exclude-standard -x show.patch | xargs -I {} git diff /dev/null {} >> show.patch
It is equivalent to git add . ; git diff --cached --diff-filter=A >> show.patch ; git restore --staged .
is there way to put this bash magic to pom.xml
and use it ? in real project (eclipse-cs)
This would be better if it was also possible to use this on Windows and not just Linux. I am not sure if Windows recognizes /dev/null
.
Not an issue with patch filter itself, but we need documentation on the best way to set up this repo for our users. There is nothing in our readme for this.
Identified when testing https://github.com/checkstyle/patch-filters/issues/352 , I made changes to the repo but did not commit them. They did not appear in
show.patch
which wasn't expected.I test my changes before committing them all the time to ensure I am not committing something bad and losing my original work. I think we should find some way to include unstaged changes as well with the top commit.
Repo's patch file creation: https://github.com/checkstyle/eclipse-cs/blob/master/pom.xml#L125-L131