
除了 git rebase 以外,還可以試試看 git push -f 然後再來個 git gc (?)
軟體開發、伺服器和生活瑣事

除了 git rebase 以外,還可以試試看 git push -f 然後再來個 git gc (?)
假設今天在 branch docs 寫文件時,發現某個程式有 bug 需要到 master 送一個 hotfix,完成後在切換回原來的 branch docs,可以使用 git checkout - 來做到:
git checkout master Switched to branch 'master' git checkout - Switched to branch 'docs'
發現這個用法,其實是因為在 bash 中要切換目錄 cd - 時,不小心把 cd 打成 git,沒想到還真的有這功能 XD
在專案的 wiki 頁面,沒有檢視 raw data 的功能,所以選取、貼上很麻煩。Github 的 wiki 頁面也是使用 git 管理,因此可以透過 git clone 將頁面複製出來。
這邊以 CKIP tagger 專案當作範例,專案的 wiki 有很多頁面,wiki 的 git repository 為專案 URL 加上 .wiki。
例如 git repository 的 URL 為:
https://github.com/ckiplab/ckiptagger.git
那麼該專案的 wiki 的路徑為:
https://github.com/ckiplab/ckiptagger.wiki.git
git clone 完成以後,先在自己的 wiki 上隨便建立一個頁面,然後依樣畫葫蘆來取得自己 wiki 的 URL,然後用 git push -f 把 wiki 推上去。
舊版本的 git 有安全性漏洞,需要升級到 2.7.1 以上版本
server and client side remote code execution through a buffer overflow in all git versions before 2.7.1 (unpublished ᴄᴠᴇ-2016-2324 and ᴄᴠᴇ‑2016‑2315)
Ubuntu 14.04 的 git 還在 1.x,只好靠 PPA 抓新版本:
sudo add-apt-repository ppa:git-core/ppa
sudo aptitude update && sudo aptitude upgrade