tags:

views:

35

answers:

1

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

alt text

git config --global filter.tabspace.clean 'script_to_clean_tabs_at_eol'

Use the 'clean' step to cleanup tabs.

VonC