1. 停止在本地追踪某个文件
git update-index --assume-unchanged <filename>
2. 暂时将未提交的文件移除,然后在移入
git stash
git stash pop
3. 向前重置工作区和暂存区
git reset --hard commit-id
4. 选择一个commit合并到当前分支
git cherry-pick commit-id
原文:https://www.cnblogs.com/wxxiong/p/12562885.html