如何撤销上一个提交(还没有push到服务器之前):
git reset --soft HEAD^ or git reset --soft HEAD~
This will undo the last commit.
Here --soft
means reset into staging.
HEAD~ or HEAD^
means to move to commit before HEAD.
Replace last commit to new commit:
git commit --amend -m "message"
It will replace the last commit with the new commit.
如何删除一个submodule:
- Delete the relevant section from the .gitmodules file.
- Stage the .gitmodules changes
- ```git add .gitmodules```
- Delete the relevant section from .git/config.
- Run git rm --cached path_to_submodule (no trailing slash).
- Run rm -rf .git/modules/path_to_submodule (no trailing slash).
- Commit git commit -m "Removed submodule "
- Delete the now untracked submodule files rm -rf path_to_submodule