GitとGerritのFAQ
GitとGerrit の使い方に関するFAQをご紹介します。
Git
プルする
git pull origin master
またはgit pull gerrit master
を使用する必要がありますか?
gitの専門家でない限り、これらは同じであるはずです。 The remote repository "gerrit" is the "origin" for the code of Wikimedia projects. Change directory to a repository and enter git remote -v to see what remotes uses.
As Gerrit/Tutorial#Configuring git-review says, you can put the following in ~/.config/git-review/git-review.conf
to ensure this:
[gerrit]
defaultremote = origin
It says "Please, commit your changes or stash them before you can merge." What do I do?
変更内容(およびstashにあるもの)を破棄するには:
git stash git stash clear
これで、プルを続行できるようになりました。
コミットする
What's the difference between git commit --amend
and git commit --amend -a
?
The -a
option automatically stages all tracked, modified files before the commit, letting you skip the git add
step unless you need to start tracking new files.
A tracked file is a file that was in your last commit.
Submitting for review
When should I use git review -R
rather than just git review
?
You use git review -R
when you don't want your changes to be rebased, because you already used git pull --rebase origin master
.
To be more specific, when amending an existing change (adding changes to an existing patch set), you don't want to rebase against the master branch, as it causes the diffs to be cluttered.
Gerrit
コメント
How do I save inline code comments? I can only save them as drafts.
You have to click the "Up" button to go back to the change overview page.
The inline comments will be attached to your "global" comment when you "reply" (save your comment).
その他
How do I watch changes?
How do I link to Gerrit URLs from Wikimedia wikis using internal link syntax?
To link to revision 1234 use [[gerrit:1234|revision 1234]]: revision 1234.