git-add only whitespace changes?
You can try the following “trick”: git add -A git diff –cached -w | git apply –cached -R This basically adds everything to the index, then unstages all changes which affect more than whitespace.
You can try the following “trick”: git add -A git diff –cached -w | git apply –cached -R This basically adds everything to the index, then unstages all changes which affect more than whitespace.
Following the history from the pull request to add this feature it looks like this is the correct syntax: <h4> {{~#object~}} Surrounding whitespace would be removed. {{/object}} </h4> Result: <h4>Surrounding whitespace would be removed.</h4> There is also this syntax which trims only leading whitespace: <h4> {{~#object}} Only leading whitespace would be removed. {{/object}} </h4> Result: … Read more
SELECT trim(regexp_replace(col_name, ‘\s+’, ‘ ‘, ‘g’)) as col_name FROM table_name; Or In case of update : UPDATE table_name SET col_name = trim(regexp_replace(col_name, ‘\s+’, ‘ ‘, ‘g’)); The regexp_replace is flags are described on this section of the documentation.
Try list comprehension and string.strip(): >>> mystr = “L1\nL2\n\nL3\nL4\n \n\nL5″ >>> mystr.split(‘\n’) [‘L1’, ‘L2’, ”, ‘L3’, ‘L4’, ‘ ‘, ”, ‘L5’] >>> [line for line in mystr.split(‘\n’) if line.strip()] [‘L1’, ‘L2’, ‘L3’, ‘L4’, ‘L5’]
Git1.6.0.4 seems a bit old, especially if you consider that: in 1.6.3.4, “git apply –whitespace=fix” did not fix trailing whitespace on an incomplete line in 1.6.3.2, “whitespace” attribute that is set was meant to detect all errors known to git, but it told git to ignore trailing carriage-returns. Could you try with Git1.6.4.1, and rather … Read more
The problem is twofold. First of all, Haskell is indentation sensitive, e.g. the following code isn’t valid: example = (a, b) where a = “Hello” b = “World” Both bindings need to be indented with the same number of spaces/tabs (see off-side rule). While it’s obvious in this case, it’s rather hidden in the following … Read more
This actually has nothing to do with git diff. git diff actually renders a tab, which is later converted by your terminal emulators (for instance, gnome-terminal) to spaces. Go to the preference of your terminal emulator to change that setting. Also, git may use a pager, so you might want to configure it like that: … Read more