前言
最近公司因項目拆分,要將原有代碼移植到新的 Git 項目組。剛開始是想把代碼直接拷貝過去,但提交的歷史信息和原有分支就會丟失。于是網上找了下方法具體操作了一次可行,這里就記錄一下。
git clone --mirror https://github.com/xxxxxxx/oldProject.git
cd oldProject.git
git remote set-url –-push origin https://github.com/xxxxxxx/newProject.git
git push –-mirror
總結
簡單的幾個命令就搞定,Git 很強。