[Development] Announcing git-gerrit-pick

Thiago Macieira thiago.macieira at intel.com
Tue Apr 9 21:44:46 CEST 2013


https://codereview.qt-project.org/50795

Because "git cherry-pick-and-gpush" was too long. Suggestion:

	git config --global alias.gp gerrit-pick

As the long name says, it does cherry-picks and then pushes the result to 
Gerrit. The simple usage is, therefore, similar to git cherry-pick:

	git gp commit1 commit2 commit3
OR
	git gp commit1..commit2

Unlike cherry-pick, this command does NOT change the working tree. It uses git 
apply --cached for its functionality, so you do not have to stop what you're 
doing in order to do the pushes. You don't even have to commit unfinished 
changes!

Switches:
 -t | --target	target branch name (stable, dev); default: upstream of HEAD
 -r | --remote	name of the remote to push to; default: "gerrit"
 -b | --base	commit to apply the changes on top of; default: upstream
 -n | --dry-run	do everything except actually push
 -v | --verbose	produce more output

Example usages:

Pushing the last commit made to remote named "gerrit", to the upstream of the 
current branch:
	git gp HEAD

Same, but adding Ossi as a reviewer:

	git gp HEAD +ossi
	git gp +ossi HEAD

Same, and now sending the last two commits:

	git gp HEAD~ HEAD +ossi
	git gp HEAD~2.. +ossi

Same, but now targetting dev instead of the upstream branch:

	git gp -t dev HEAD~2.. +ossi

Same, and now set the base commit (hint: get the SHA-1 of the last patch-set 
from the Gerrit web interface and add ~):

	git gp -t dev -b 4d1dc4b32bb4c4c25bde720299557a4ff3e344e2~ HEAD~2..

Here's my lossage:
$ history -n 1 | grep 'git gp'
git gp HEAD +fregl +jpassion +lpotter
git gp +lpapp at kde.org +denis.shienkov at gmail.com HEAD
git gp +lpapp at kde.org +denis.shienkov at gmail.com HEAD
git gp +lpapp at kde.org +denis.shienkov at gmail.com HEAD
git gp HEAD
git gp +ogoffart c39fc596c6984e94af7f7e5b14de130ad520c26e
git gp 2ff6182
git gp +nierob +ogoffart 
11297b4c7661f99a91c9df5e4f6596dad3e5dea7..653bfe660e18f09df04dbd294ece64d7b8cda72a 
-t dev
git gp HEAD +christian.stromme at digia.com +yoann.lopes at digia.com
git gp
git gp HEAD
git gp HEAD +mccarthy.aaron at gmail.com
git gp b5728f3 -b 714ff76a75c1262aee052a7f9a637528d2be8063~
git gp -b 4d1dc4b32bb4c4c25bde720299557a4ff3e344e2~ :/Re-shuffle

That "git gp" didn't do anything
-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20130409/61c3aa7b/attachment.sig>


More information about the Development mailing list