git重置到某次提交 移除之前的提交.md 941 B

#杂七杂八常识

先找到对应提交的guid

![[Pasted image 20221203224153.png]]

分别是之后和之前:

![[Pasted image 20221203224211.png]]

硬重置到这次提交

git reset --hard 98ee9e88

![[Pasted image 20221203224346.png]]

强推

git push --force

![[Pasted image 20221203224426.png]]

强推后的版本线,就是只有之前的了,没有之后的

![[Pasted image 20221203225001.png]]

补充说明,硬重置到当前提交(包括删除东西)

git reset --hard

![[Pasted image 20221203224601.png]]

补充说明,git清理,会清理无版本控制的:

git clean -df

![[Pasted image 20221203224650.png]]

为了规避不应该被删除的东西被删,需要这样处理一下,添加到忽略列表

![[Pasted image 20221203225130.png]]

如果需要不被忽略,从文本里移除路径就好

![[Pasted image 20221203225210.png]]