赞
踩
获取撤销信息
通过git log命令查看提交信息,以便获取要撤销的版本号- $ git log
- commit 9b653b5629aa989609965cac0a612de06aa6ffc8 (HEAD -> master, origin/master)
- Author: huangxiansheng <xx@qq.com>
- Date: Mon Mar 15 14:08:35 2021 +0800
-
- 添加要撤销的内容
-
- commit 1acf09e45cc2f044acf7983fe70372551d96c3da
- Author: huangxiansheng <xx@qq.com>
- Date: Mon Mar 15 14:07:53 2021 +0800
-
- 更新内容
-
- commit 85f180a615784cc892d967ea4f049b6c015f66ca
- Author: huangxiansheng <xx@qq.com>
- Date: Mon Mar 15 14:07:11 2021 +0800
-
- first commit
重置版本信息
通过git reset --hard <版本号>重置到指定版本的提交,达到撤销提交的目的- $ git reset --hard 1acf09e45cc2f044acf7983fe70372551d96c3da
- HEAD is now at 1acf09e 更新内容
撤销远程操作
命令:git push origin master --force 通过强制提交当前版本号到线上,以便达到撤销版本号的目的,必须添加force进行强制提交- $ git push origin master --force
- Total 0 (delta 0), reused 0 (delta 0)
- remote: Updating references: 100% (1/1)
- To http://git.com/git/huangxiansheng/testGIt.git
- + 9b653b5...1acf09e master -> master (forced update)
-
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。