gerrit 使用中踩过的小坑

xiaoxiao2021-02-28  132

gerrit 使用中踩过的小坑

gerrit 不能推送 merge

git push origin HEAD:refs/for/master Counting objects: 203, done. Delta compression using up to 4 threads. Compressing objects: 100% (37/37), done. Writing objects: 100% (59/59), 6.84 KiB | 0 bytes/s, done. Total 59 (delta 26), reused 0 (delta 0) remote: Resolving deltas: 100% (26/26) remote: Processing changes: refs: 1, done To ssh://yuzx@xxx.com:29418/xxxrowd ! [remote rejected] HEAD -> refs/for/master (you are not allowed to upload merges) error: 无法推送一些引用到 'ssh://yuzx@xxx.xxx.com:29418/xxxrowd' 12345678910111213 12345678910111213

解决办法

git rebase Cannot rebase: You have unstaged changes. git stash # 每次 push 前 git pull --rebase git push origin HEAD:refs/for/master # gerrit review git pull git stash pop 1234567891011 1234567891011

因在 master 上开发,导致和远程冲突,这时 Git pull 默认 merge 模式  gerrit 不允许 merge 后提交,需 rebase 方式,所以,本地 pull 以 rebase 方式进行,即:  git pull –rebase

gerrit review 报错

Code Review - Error The change could not be merged due to a path conflict. Please rebase the change locally and upload the rebased commit for review. 123 123

处理

git stash # 每次 push 前 git pull --rebase git stash pop 1234 1234

eclipse 黑星:已暂存,存在于 INDEX 中。

未添加 .ignore 文件前使用 git add . 将所有文件添加到库中,不小心将一些不需要加入版本库的文件加到了版本库中。此时还没有提交所以不存在 HEAD 版本,不能用 git reset HEAD

git rm -r –cached .

服务器部署裸库,什么是裸库?

其实就是 .git 目录

git clone –bare my_project my_project.git

等价于

cp -Rf my_project/.git my_project.git

转载请注明原文地址: https://www.6miu.com/read-33782.html

最新回复(0)