我發出以下命令:無法回退1步後推混帳
git reset --hard HEAD~1
該臺階代碼回1個推,因爲我想要的。然後我做的代碼一些改變,做:
git add -A
git push
而且回來...
! [rejected] master -> master (non-fast-forward)
hint: Updates were rejected because the tip of your current branch is behind
所以我做了以下嘗試強行:
git push -f
結果是:
Counting objects: 360, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (220/220), done.
Writing objects: 100% (230/230), 1.97 MiB | 354.00 KiB/s, done.
Total 230 (delta 81), reused 0 (delta 0)
remote: Analyzing objects (230/230) (18348 ms)
remote: Storing pack file and index... done (284 ms)
To <url>
! [remote rejected] master -> master (TF401026: The ForcePush permission is required to perform this action.)
error: failed to push some refs to '<url>'
那麼我該如何推這個代碼t o是當前的主代碼?
git存儲在visualstudio.com上,如果這有所作爲。
您沒有'ForcePush權限'。這由遠程主機控制。爲什麼不做'revert'而不是重置? – helion3
我列出了我所做的。如果有辦法解決它,請在答案中提出建議。 –
您無法強制推送,因爲遠程主機顯然阻止了您。爲什麼'git reset --hard HEAD〜1'而不是還原需要刪除的提交? – helion3