Some random stuff
Automatically push to bitbucket
I wrote a crontab to automatically run git commit and git push to back up my bitbucket pages. To push successfully I need to install keychain and run
/usr/local/bin/keychain $HOME/.ssh/id_dsa
Then add
source $HOME/.keychain/${HOSTNAME}-sh
to my shell script.
git change commit message after push
From stackoverflow,
git commit --amend -m "message"
git push --force
Anyone already pulled needs to do
git fetch origin
git reset --hard origin/master # Loses local commits
vim open/close folding
open folding zo close folding zc toggle folding za
git rewrite history
Change the last commit
$ git commit --amend
If I forgot to add or remove a file, I can first run git add or git rm, then git commit --amend.