Gerrit 添加本地已有仓库
本文信息
创建时间: 2022.04.10 22:41:25
更新时间: 2022.10.10 21:11:20
首先本地git必须有commit
Bash |
---|
| git add xxx
git commit -m "init xxx"
|
然后添加远端地址
Bash |
---|
| git remote add origin "ssh://lzwang@192.168.2.145:29418/my-repo" && scp -p -P 29418 lzwang@192.168.2.145:hooks/commit-msg ".git/hooks/"
|
警告
原有的commit需要加上 Change-ID,否则Gerrit无法识别变更单号
建立本地与远端的分支关联
Bash |
---|
| git branch --set-upstream-to=origin/master master
|
拉取并合并远端最新的变更
Bash |
---|
| git fetch
git status
# 忽略本地与远端历史差异,强制合并
git pull --allow-unrelated-histories
|
推送到远端
Bash |
---|
| git push origin HEAD:refs/for/master
|