The Golang dependency tool dep
is awesome, but it has this habit of mark files as changed when the only difference is related to line-endings. The following one-line script reverts those changes:
git checkout -- \
$(for f in $(git status --porcelain | \
grep " M" | awk '{print $2}'); do \
if git --no-pager diff $f 2>&1 | head -n 1 | grep -q "warning: CRLF will be replaced by LF"; then \
echo $f; \
fi; \
done;)