我們需要回到特定的提交時間。掌握了一些意外的變化。試圖恢復它挖得太深,所以主人處於不良狀態。我們現在想讓主人回到66ada4cc61d62afc。回到版本庫中的特定版本後提交併推送更改?
根據git revert back to certain commit:
$ git reset --hard 66ada4cc61d62afc
HEAD is now at 66ada4c Updated documentation
然後,試圖將其提交:
$ git add *.h *.cpp
$ git commit -m "Go back to Commit 66ada4cc61d62afc"
On branch master
Your branch is behind 'origin/master' by 16 commits, and can be fast-forwarded.
(use "git pull" to update your local branch)
nothing to commit, working directory clean
最後:
$ git push
To https://github.com/weidai11/cryptopp.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/weidai11/cryptopp.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
眼下,一切也正是它,我想是。我不知道Git爲什麼會遇到麻煩,Git在談論什麼。如果Git完成了它被告知的事情,那肯定會很好。但是,唉,Git讓每一個簡單的任務都變得困難,並且會給人帶來不必要的痛苦和痛苦。
如何提交和推送更改?
'git的revert'被審判,但它成功地撤銷之前'66ada4cc61d62afc'變化。我認爲這是因爲意外推動的公關反對以前的圖書館狀態。 – jww