Skip to content

Instantly share code, notes, and snippets.

@azat
Last active August 29, 2015 14:02
Show Gist options
  • Save azat/bbc65562d1808499429d to your computer and use it in GitHub Desktop.
Save azat/bbc65562d1808499429d to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
echo "Stage 1: modified"
git st -s | grep '^ M' | fgrep .kde | awk '{print $NF}' | \
xargs -r -i sh -c 'mv {} /tmp/ && echo {} >> .gitignore'
git ci .kde/share/config .gitignore -m 'ignore: more dynamic configs (modified)'
git show .gitignore | grep ^+.kde | awk -F/ '{print $NF}' | xargs -r -i mv /tmp/{} .kde/share/config/
echo "Stage 2: untracked"
git st -s -uall | grep '^??' | awk '{print $NF}' | xargs -r -i sh -c 'echo {} >> .gitignore'
git ci .kde/share/config .gitignore -m 'ignore: more dynamic configs (untracked)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment