Skip to content

Instantly share code, notes, and snippets.

@oleksiialeksieiev
Created September 2, 2016 21:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oleksiialeksieiev/eb035fc8739447a21248abec32b8c12d to your computer and use it in GitHub Desktop.
Save oleksiialeksieiev/eb035fc8739447a21248abec32b8c12d to your computer and use it in GitHub Desktop.
Git cheat sheet
GERRIT_SSH_USER=<user>
GERRIT_HOST=<gerrit_ip_or_host>
GERRIT_PORT=29418 # by default
#download commit-message hook
gitdir=$(git rev-parse --git-dir); scp -p -P ${GERRIT_PORT} ${GERRIT_SSH_USER}@${GERRIT_HOST}:hooks/commit-msg ${gitdir}/hooks/
chmod +x .git/hooks/commit-msg
#Adding "Verified" label
mkdir tmp
cd tmp
git init
git remote add origin ssh://$GERRIT_SSH_USER@$GERRIT_HOST:$GERRIT_PORT/All-Projects
git fetch origin refs/meta/config:refs/remotes/origin/meta/config
git checkout meta/config
cat >> project.config <<EOF
[label "Verified"]
function = MaxWithBlock
value = -1 Fails
value = 0 No score
value = +1 Verified
EOF
git commit -a
git push origin meta/config:meta/config
#Setting email address for User using CLI
#https://gerrit-review.googlesource.com/Documentation/cmd-set-account.html
ssh -p 29418 $GERRIT_SSH_USER@$GERRIT_HOST:$GERRIT_PORT gerrit set-account account-name --add-email account@domain
#push for review
git push origin HEAD:refs/for/master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment