1.
- 生成patch file
git format-patch -1
- 应用patch
git apply [file]
(
打linux patch
patch -p1 < diff.patch
)
2.
- rebase切换version
git branch -r // 列可用
git rebase [branch name]
3.
-上传代码
git push [remote server] HEAD:refs/for/[branch]
git remote -v 可以查看远程server name
4.
git commit --amend
5.
- 保存现场 恢复现场
git stash
repo sync .
git stash list
git stash pop [stash@index]
6.
- 遇到fetch error时
repo --trace sync -c 2 >sync.log
(极有可能local work tree can't be overwritten)
7.
- git add了多余文件时
git reset HEAD [file]
8.
- 上传了patch 1, 在gerrit上rebase到patch 2.
然后本地又改了一版。
此时如果直接push,会需要再rebase出patch 4.
可以本地先rebase
git stash // 保存本地的patch 3
repo sync . -c -f
[fetch patch 1 & cherry-pick]
git stash pop
9.
gerrit/plugins/gitiles/[repo name]/+/[file path]
同理可用blame