#! /bin/zsh # # this file: # https://dataswamp.org/~incal/conf/.zsh/git # # git config: # ~/.gitconfig # # useful git commands: # $ git checkout -b ib master # [...] # $ git commit -a # # $ git format-patch master -M -o .ib # M-x erc-bug RET # Tags: patch (pseudo header) # C-c C-a (`mml-attach-file') # C-c C-c (`message-send-and-exit') # # $ git log # $ git format-patch -2 HEAD --stdout > last-two.patch # # $ git commit --amend # # $ git reflog # $ git revert fa37950454f # # $ git branch # $ git branch -D ib # # $ git log --graph --oneline --decorate -a (alias 'glog', config file above) # $ git rebase -i HEAD~5 (git rebase --abort) # $ git pull # $ git rebase --onto origin/master 'ib^' ib # $ git format-patch master -M -o .ib # # $ git commit --amend # # $ git diff git-init () { local name=wrap-search local srv=dataswamp.org local repo=public_html/${name}.git local git_dir=~/git local dir=${git_dir}/${name} local elisp_file=${name}.el rm -f -r ${git_dir} git init ${dir} cd ${dir} \cp -f ~/public_html/emacs-init/${elisp_file} . git add ${elisp_file} git commit -m "Initial commit" git remote add origin ${USER}@${srv}:${repo} git push --set-upstream origin master cd - } git-update () { local name=wrap-search \cp -f ~/public_html/emacs-init/${name}.el ~/git/${name} local dir=$(pwd) cd ~/git/wrap-search/ git diff -q --exit-code if [[ $? == 1 ]]; then git commit -a -m "$(date)" git push -q fi cd $dir } git-clone () { cd ~/src git clone https://dataswamp.org/~incal/wrap-search.git } git-cred-all () { git shortlog -s -n --all | awk '{print ++c, $0}' } git-cred () { local name=$@ git-cred-all | grep --color=never $name }