注我張貼在askubuntu這個問題,但我沒有得到一個answer.I看見元this post,所以我想我會嘗試SO張貼。混帳,同步新的存儲庫
因此,我已經基於Github上的現有存儲庫初始化了一個git存儲庫。我正在啓動的項目與爲存儲庫列出的最新提交大不相同。
當我試圖執行器這組命令
git init
git remote add origin https://github.com/account/repo
git fetch origin
git add -A
git commit -m "message"
git push origin master
我收到以下錯誤:
To https://github.com/account/repo
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/account/repo'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.
的事情是,我知道有這個倉庫和產地之間的差異,但我明確不想從存儲庫中獲取最新的更改。我想用這個倉庫中的修改來覆蓋Github上的更改。
有沒有辦法做到這一點?無論如何,即使出現快進錯誤也要強制推送?
感謝您的幫助或指導。
編輯:會亞當Dymitruk this question工作的答案,或執行上述命令的順序已經搞砸了他的方法?
訪問舊項目歷史記錄如果您的目標是丟失原始回購的歷史記錄,並將其替換爲您在本地回購庫中的內容,爲何你首先從這個原始回購開始,而不是創建一個全新的回購? – 2014-10-12 06:55:48