Skip to content

Instantly share code, notes, and snippets.

@balibali
Created March 9, 2011 06:40
Show Gist options
  • Save balibali/861786 to your computer and use it in GitHub Desktop.
Save balibali/861786 to your computer and use it in GitHub Desktop.
Emacs設定ファイル置いてる gist-846942 とローカルのファイルを同期するための適当すぎワロタスクリプト
#!/bin/sh
labeled_diff()
{
if [ $1 ]; then
diff -u --label "local/init.el" ../init.el --label "gist/init.el" init.el
else
diff -u --label "gist/init.el" init.el --label "local/init.el" ../init.el
fi
}
cd ~/.emacs.d/gist-846942
case $1 in
# pull: gist => local
pull)
git pull > /dev/null
labeled_diff 1
cp init.el ../init.el
;;
# push: local => gist
push)
labeled_diff
cp ../init.el init.el
git add init.el
git commit -mtetete && git push
;;
diff)
labeled_diff | vim -R -
;;
*)
echo "Usage: $(basename $0) pull"
echo " $(basename $0) push"
echo " $(basename $0) diff"
exit 1
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment