문제

I was working on the project with git, and now I am trying to import it to the gerrit for better SCM.

I know I can import existing git repo by copying it into the gerrit or direct pushing without reviewing.

However, I want to preserve commit history into the gerrit.

For doing that, I tried pushing all the commits of the master branch into the gerrit.

git push HEAD:refs/for/master

However, it was not pushed because it does not have a change-id.

I know I can attach change-id to the last commit, but it is useless if it is not attached in the first commit.

If I modify the first commit message by resetting to the first commit, I can push the first commit to the gerrit.

However, in this case, I still cannot preserve next commit history because change of the first commit makes conflicts with next commits.

Is there any good idea for solving this?

Please help.

도움이 되었습니까?

해결책

I want to preserve it into the gerrit server so that all the history is shown in the All->merged of the gerrit server

...

it was not pushed because it does not have a change-id.

If you really want to show all commits in the All->merged page, you are doing it right. Be aware that once you work around the change-id issue you will have to mark each commit as reviewed and submit them individually. If you have a large number of commits in your repository history, this will take quite a while. You could look into automating it with an SSH or REST script.

To get past the change-id issue, there is a project setting to not require this tag. Go to the admin page for your project (See example) and look for the Require Change-Id in commit message: setting. Change it to False and save your changes, then do your push. You'll probably want to set it back to True or Inherit when you are done.

다른 팁

with direct push you can preserve commit history as well. So instead of pushing to review branch push them to the remote branch directly. git push origin master you need a direct push and forge commiter permission

At the time of gerrit installation, please set the repository path as your existing git repository location.

I have also raised a similar doubt regarding this. see Gerrit - Gitlab Integration

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top