Do you have a clean way to list all the files that ever existed in specified branch?
thanks
From stackoverflow
-
You can run
git-log --name-status, which echoes something like:commit afdbbaf52ab24ef7ce1daaf75f3aaf18c4d2fee0 Author: Your Name <your@email.com> Date: Tue Aug 12 13:28:34 2008 -0700 Added test file. A testThen extract files added:
git-log --name-status | sed -ne 's/^A[^u]//p' | sort -u -
Variation on Strager's:
git log --pretty=format: --name-status | cut -f2- | sort -uEdit:
Thanks to Jakub for teaching me a bit more in the comments:
git log --pretty=format: --name-only --diff-filter=A | sort -Shorter pipeline, more opportunity to git to get things right.
strager : Hmm, I guess yours is superior. +1. =]elmarco : whao, awesome, and fast! thank you!Pat Notz : Hmmmm. using "uniq -u" may be faster and more memory efficient than "sort -u" if you don't actually want the output sorted. Could make a difference on big repos.Jakub Narębski : @Pat: uniq requires sorted input, so you have to use sortJakub Narębski : @Dustlin: Add --diff-filter=A option (list only added files). Current version (without sed filtering only added files) would fail if you have enabled rename detection and have renames in history. I think you can then use --name-only instead of --name-status and remove 'cut -f2-' from pipeline.
0 comments:
Post a Comment