git分场景使用记录

撤销某次提交

在检查一个开发分支的的提交历史时,发现误将应在另一个开发分支提交的文件提交到了这个开发分支。由于这次误提交比较独立,即使撤销也不会影响其它提交,所以使用git revert <commit-id>將这次提交撤销。

git子模用法

git submodule update --remote --recursive --init # 更新所有子模块及其依赖

# git子模块切换分支
git config --file=.gitmodules -l # 列出所有子模块

# 示例输出
# submodule.modules/<module name>.path=path/relative/to/project-root
# submodule.modules/<module name>.url=http://git.code.oa.com/avcomm/trtc-partner/trtc-protocol-stack.git
# submodule.modules/<module name>.branch=master

# 更新子模块url
git config --file=.gitmodules submodule.<module name>.url https://some-git-repo.com/username/name.git

# 切换子模块分支
git config --file=.gitmodules submodule.<module name>.branch some-branch

# 同步并更新
git submodule sync
git submodule update --init --recursive --remote
posted @ 2020-10-19 11:40  戊戌乡人  阅读(90)  评论(0)    收藏  举报