3

I'm initially trying to adapt soft tabs in my projects but some testing with a python project tracked by git is showing issues; naturally git thinks everything has changed, and that is not what I'd prefer.

While git diff understands to drop whitespace from comparison with -w switch, there's no such switch for git commit.

Is the transition impossible to do nicely or is there a way to achieve git to ignore the sudden change?

6
  • 2
    I don't understand. Do you want to commit the change from tabs to spaces or not? Why is it bad that "git thinks everything has changed"? If you've changed every line with a tab, then that may well be the case. Commented Jul 25, 2010 at 9:42
  • Changing indentation doesn't bring anything to the code and therefore clutters comparing commits between pre- and post-change. Commented Jul 25, 2010 at 9:44
  • 3
    I still don't understand. If it doesn't bring anything to the code then don't change it. If your issue is purely about ignoring whitespace in the changes why not continue to use -w with diff (and show and log, etc.) ? Commented Jul 25, 2010 at 9:46
  • My comments weren't thoughts, though, they were questions. Is your question purely about the display of diffs, or so you want to do something different like use soft tabs in your worktree but not commit the tab-to-space change when using commit which is what your original question implied? I genuinely still don't understand exactly what you are asking. Commented Jul 25, 2010 at 9:56
  • Brought to us by harshh below, this is a possible duplicate of Can git automatically switch between spaces and tabs? Commented Jul 25, 2010 at 10:08

1 Answer 1

4

Can git automatically switch between spaces and tabs?

Sign up to request clarification or add additional context in comments.

1 Comment

It's a very good solution but I wouldn't be comfortable with having different contents in work dir and the repo

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.