I am contributing code to an open source project which requires that no tabs exist in source code(only spaces). I am sure I have used tabs accidentally in some places, and want to clean up my code before I submit a patch. How can I find uses of tabs in a commit range?
+2
A:
For commits you haven't pushed yet, you can use filter-branch:
See this SO question for a concrete example
git filter-branch --tree-filter '~/Scripts/fix-line-endings.sh' -- --all
(that is for all commits, you need to restrict it for a range of commit, see git filter-branch
man page)
For future commits, use a filter driver
git config --global filter.tabspace.clean 'script_to_clean_tabs_at_eol'
Use the 'clean
' step to cleanup tabs.
VonC
2010-05-09 19:14:05