2013年7月18日 星期四

git revert without change-id

We can use git revert to revert a commit. But if you need a change-id, you will find git revert won't invoke commit-msg hooks. And you won't get a change-id for this commit.
Here is a workaround.

git revert -n <<commit-id>>
git commit

refer to git-revert,
-n
--no-commit
Usually the command automatically creates some commits with commit log messages stating which commits were reverted. This flag applies the changes necessary to revert the named commits to your working tree and the index, but does not make the commits. In addition, when this option is used, your index does not have to match the HEAD commit. The revert is done against the beginning state of your index.
This is useful when reverting more than one commits' effect to your index in a row.

2013年7月15日 星期一

how to add an existing git repo. to gerrit project.

1. Create new project in gerrit. command as below.
ssh -p 29418 user@gerrit.server gerrit create-project --name gerrit_project_name

2. Push existing git repo. to gerrit server as below.
git push ssh://user@gerrit.server:29418/gerrit_project_name HEAD:refs/heads/master