Joined January 2013

Mathias Lafeldt


@steve-jansen Good to know. Thank you!

And if you think it's okay to live with reStructuredText, converting is that simple using the pandoc command-line tool:

$ pandoc --from=markdown --to=rst -o README.rst

Psst. You might want to replace this

git ls-tree -r master | awk "{print \$4}"

with this:

git ls-files


Posted to Stage all git deletions over 1 year ago

Or you simply use git add -u (or git add --all to add new files as well).


Posted to Bash Include Guard over 1 year ago

I've used basically the same trick to speed up a massive shell code base (20,000+ lines, don't ask) that used sourcing a lot.

Another tip: When you export all variables inside a (POSIX) shell script without functions, you can export the include guard as well. Should speed things up further for child processes.

Posted to Remove deleted files from git over 1 year ago

git add --all does the same, plus it adds all new/changed files to the index. Great to sync the working copy with the index.

FYI, I've updated the protip (title and contents) in response to your comments. Thanks again.

Thanks for your comments. I know about touch and the dangers of > file. But the latter is faster to type and less people might know that redirections can be used this way. Perhaps a better title would have been "Easiest way to create or empty a file in Shell".

Posted to Removing files from git over 1 year ago

"git clean" would be another option. With -x, it will also remove both untracked and ignored files.

I have a git alias "distclean" that maps to "clean -ffdx". Very handy.

1,285 Karma
78,688 Total ProTip Views
Interests & Skills