如何从未入库的gerrit中撤销一个文件

用一个例子说明

比如有一个提交里面的default.xml的修改没有必要,需要从未入库的gerrit中移除

步骤如下:

1.做reset操作

git reset HEAD^ packages/SettingsProvider/res/values/defaults.xml

2.做checkout操作

git checkout packages/SettingsProvider/res/values/defaults.xml

3.进行修复式commit

git commit --amend

此步骤操作后用git diff看,需要移除的文件已经不在commit中了

4. 进行push,将修改push到gerrit

git push origin HEAD:refs/for/xxx

  • 10
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要在Gerrit之间进行同步,可以使用Gerrit提供的Replication功能。下面是同步两个Gerrit服务器的步骤: 1. 在源Gerrit服务器上配置Replication插件。在Gerrit服务器的`gerrit.config`文件添加以下内容: ``` [plugin "replication"] url = ssh://<username>@<destination_gerrit_server>:<port>/<path_to_gerrit_site> replicateAllOnStartup = true ``` 其,`<username>`是目标Gerrit服务器的用户名,`<destination_gerrit_server>`是目标Gerrit服务器的地址,`<port>`是目标Gerrit服务器的SSH端口号,`<path_to_gerrit_site>`是目标Gerrit服务器的Gerrit Site路径。 2. 在目标Gerrit服务器上配置SSH访问。确保源Gerrit服务器的SSH公钥已添加到目标Gerrit服务器的`authorized_keys`文件。 3. 在源Gerrit服务器上创建一个新的Replication配置。使用以下命令: ``` ssh -p <port> <username>@<destination_gerrit_server> gerrit create-project --name <project_name> ``` 其,`<port>`是目标Gerrit服务器的SSH端口号,`<username>`是目标Gerrit服务器的用户名,`<destination_gerrit_server>`是目标Gerrit服务器的地址,`<project_name>`是要同步的项目名称。 4. 在源Gerrit服务器上启动Replication。使用以下命令: ``` ssh -p <port> <username>@<destination_gerrit_server> gerrit replicate --project <project_name> ``` 其,`<port>`是目标Gerrit服务器的SSH端口号,`<username>`是目标Gerrit服务器的用户名,`<destination_gerrit_server>`是目标Gerrit服务器的地址,`<project_name>`是要同步的项目名称。 这样,源Gerrit服务器上的更改将自动同步到目标Gerrit服务器上。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值