我想恢复到特定的提交ID。还原文件我“git rm”-ed。从此吹掉所有提交的提交。然后提交回购。我将如何做到这一点?撤消一堆Git混乱
0
A
回答
2
$ git reset --hard <commit ID> # Will reset to a specific commit
$ git push -f <remote> # Push branch into remote, with force
注意,任何人谁克隆你的回购可能会遇到一些小问题,如果他们只是在更改拉(因为你被迫向后跳转在提交历史);他们应该这样做是为了让您的更改:
$ git fetch <remote>
$ git reset --hard <remote>/<branch>
注意,这也将吹走的他们改变当前分支。但是,如果他们有任何由他们当前分支制作的分支,那些分支仍然会有您“吹走”的提交。
0
也许您在寻找git reset --soft {ID}
。
git reset --<mode> [<commit>]
This form resets the current branch head to <commit> and possibly updates the index (resetting it to the tree of <commit>) and the working tree depending on <mode>, which must be one of the
following:
--soft
Does not touch the index file nor the working tree at all (but resets the head to <commit>, just like all modes do). This leaves all your changed files "Changes to be committed", as git
status would put it.
不知道什么是打击”的真正含义,那为什么--hard
模式可能是有用的。
0
您可以使用混帐复归my_commit_id命令。
如果它是一个或两个以前提交,你分别使用git revert HEAD
和git revert HEAD^
而不是HEAD使用你的提交ID,如果这不能解决你的情况
这也会给你一个选项来再次编辑提交messg并创建新的提交。 `
相关问题
- 1. 整理一个Git混乱
- 2. 堆混乱和堆阵列
- 3. 撤消git commit
- 4. 撤消Git Clean
- 5. 撤消一个git存储
- 6. 撤消在混帐
- 7. 如何在git中“撤消撤消”?
- 8. 撤消git存储,git pull
- 9. ANTLR:消除混乱
- 10. Git - 撤消更改
- 11. 撤消Git rebase --abort
- 12. git撤消更改
- 13. 撤消git commit --amend
- 14. 撤消git push mirror
- 15. VS2013:Git和TFS混乱
- 16. git的变基混乱
- 17. 有混乱推代码GIT
- 18. 撤消“混帐重置--merge”
- 19. 撤消git的删除
- 20. 如何撤消Git回滚
- 21. GIT撤消分支-D
- 22. 撤消git的承诺
- 23. 撤消'git push'的问题
- 24. git分支撤消提交
- 25. Git:如何“撤消”合并
- 26. 撤消在GIT中删除
- 27. 撤消git push到Assembla
- 28. 如何撤消git mixed reset?
- 29. 如何撤消git update-index?
- 30. 如何撤消“git revert head”?
有些人认为'push -f'是犯罪! –
如果你知道自己在做什么,在某些情况下它很有用。 – mipadi