gc after git filter-branch

git for-each-ref --format='delete %(refname)' refs/original | git update-ref --stdin
git reflog expire --expire=now --all
git gc --prune=now
»

清理那些不堪回首的 Git 歷史

Git commit comment 風格慣例統一之後, 遺留在 master 上那些不堪回首的 commit history 怎麼辦?

git checkout --orphan tmp <new_starting_point>
git commit -m "bye bye history"
git rebase --onto tmp <new_starting_point> master
git branch -D tmp
»

More remotes for a GIT repo

We know we can add some other remotes and its url after an initial git remote add origin, and one more trick is that we can do some group aliases such as:

# <repo>/.git/config
[remote "mars"]
        url = <url-mars>
        fetch = +refs/heads/*:refs/remotes/origin/*
[remote "origin"]
        url = <url-origin>
        fetch = +refs/heads/*:refs/remotes/origin/*
[remote "all"]
        url = <url-mars>
        url = <url-origin>
»

Change commit time stamp in GIT

由於寫 code 專用的 VM 有時候會被我 pause, 然而 resume 後時間往往會跑掉, 這時候要是做了 commit 就會出現新 commit 的時間比舊 commit 的時間更早的怪事, 像這樣:

* ee0daaf 2013-10-16 | swap method2 and method3 (HEAD, master) [kfei]
* a1544cc 2013-10-21 | completes VD Center setup (origin/master, origin/HEAD) [kfei]
* 0a4e123 2013-10-03 | modify env check process about qemu [kfei]
...
»