Git Memo

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值