experimental/documentation/gerrit.md: improvements
https://skia.googlesource.com/skia/+/master/experimental/documentation/gerrit.md NOTRY=true Change-Id: I90d8e16e9d6146fefe0199bb98d5f8eea31d4e8f Reviewed-on: https://skia-review.googlesource.com/7750 Reviewed-by: Hal Canary <halcanary@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
This commit is contained in:
parent
5917a252bf
commit
c349f7f6ae
@ -4,16 +4,11 @@ Using Gerrit without git-cl
|
||||
setup
|
||||
-----
|
||||
|
||||
cd ...skia_source_dir...
|
||||
<pre class="code"><code>
|
||||
cd ...skia_source_dir...
|
||||
|
||||
curl -Lo .git/hooks/commit-msg \
|
||||
https://skia-review.googlesource.com/tools/hooks/commit-msg
|
||||
|
||||
chmod +x .git/hooks/commit-msg
|
||||
|
||||
git remote set-url origin https://skia.googlesource.com/skia.git
|
||||
|
||||
git config branch.autosetuprebase always
|
||||
sh [experimental/tools/setup-gerrit](../tools/setup-gerrit)
|
||||
</code></pre>
|
||||
|
||||
|
||||
creating a change
|
||||
@ -32,13 +27,13 @@ creating a change
|
||||
|
||||
3. Squash the commits:
|
||||
|
||||
MSG="$(git log --format='%B' ^@{u} @)"
|
||||
git reset --soft $(git merge-base @ @{u})
|
||||
git commit -m "$MSG" -e
|
||||
git squash-commits
|
||||
|
||||
This is only needed if you have more than one commit on your branch.
|
||||
|
||||
4. Push to Gerrit
|
||||
|
||||
git push origin @:refs/for/master%cc=reviews@skia.org
|
||||
git gerrit-push-master
|
||||
|
||||
|
||||
updating a change
|
||||
@ -48,12 +43,15 @@ updating a change
|
||||
1. Edit your commits more.
|
||||
|
||||
echo 3 > whitespace.txt
|
||||
git commit -a --amend --reuse-message=@
|
||||
git amend-head
|
||||
|
||||
2. Re-squash if needed.
|
||||
2. Re-squash if needed. (Not needed if you only amended your original commit.)
|
||||
|
||||
|
||||
3. Push to Gerrit
|
||||
3. Push to Gerrit.
|
||||
|
||||
git gerrit-push-master this is a message
|
||||
|
||||
The title of this patchset will be "this is a message".
|
||||
|
||||
git push origin @:refs/for/master%m=this_is_a_message
|
||||
|
||||
|
44
experimental/tools/setup-gerrit
Normal file
44
experimental/tools/setup-gerrit
Normal file
@ -0,0 +1,44 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Copyright 2017 Google Inc.
|
||||
#
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
cd "$(dirname "$0")/../.."
|
||||
|
||||
|
||||
### Configure the Change-Id commit-msg Git hook
|
||||
|
||||
commit_message_path="$(git rev-parse --git-dir)/hooks/commit-msg"
|
||||
|
||||
curl -Lo "$commit_message_path" \
|
||||
'https://gerrit-review.googlesource.com/tools/hooks/commit-msg'
|
||||
|
||||
chmod +x "$commit_message_path"
|
||||
|
||||
### Verify that origin points at the canonical origin, not github
|
||||
|
||||
git remote set-url origin 'https://skia.googlesource.com/skia.git'
|
||||
|
||||
### Skia uses a linear history, so rebase-on-pull is a good idea
|
||||
|
||||
git config branch.autoSetupRebase 'always'
|
||||
|
||||
### this alias does the heavy lifting of talking to gerrit
|
||||
|
||||
git config alias.gerrit-push-master \
|
||||
'!f() { git push origin @:refs/for/master%m=$(echo "$*"|sed "s/[^a-zA-Z0-9]/_/g");};f'
|
||||
|
||||
### this alias ensures that your branch has ony one commit on it
|
||||
|
||||
git config alias.squash-commits \
|
||||
'!MSG="$(git log --format=%B ^@{u} @)";git reset --soft $(git merge-base @ @{u});git commit -m "$MSG" -e'
|
||||
|
||||
### Amend the HEAD head commit without changing the commit message
|
||||
|
||||
git config alias.amend-head 'commit --all --amend --reuse-message=@'
|
||||
|
Loading…
Reference in New Issue
Block a user