Short story of two tools
Prerequisites:
git clone <repo>
cd <repo>
git checkout work-branch
# work work work
git add <changed files>
git commit
Simply do:
git push origin HEAD:refs/for/master
(you should stay on your work-branch
)
or
git push origin work-branch:refs/for/master
(you can do it from any branch you want)
Prerequisites:
- you've commit code (following previous steps from previous part)
- someone reviewed it and set
Code Review-1/-2
orVerified-1
Your steps (assuming you did nothing in your working branch since push
):
git checkout work-branch
# work work work
git add <changed files>
git commit --amend
Don't forget to add Change-Id
from Gerrit's change. Your commit message should look like follow:
Finished really cool and important feature
Change-Id: I859775bc0412c4a2a6ab8a8f71f469dd52d2dc0a
Then simply:
git push origin HEAD:refs/for/master
Follow the white rabbit:
git checkout master
git pull origin master
git checkout work-branch
git rebase master
# fix conflicts if exist
[git commit --amend]
See Fixing previous commit to make sure your ammend commit is OK. Then push
your commit.
Follow the red label:
git checkout -b new-branch <parent of refs/changes/22/13422/1>
git fetch <repo> refs/changes/22/13422/1
git merge FETCH_HEAD
git cherry-pick <commit from work-branch>
# fix conflicts if exist
Notes:
- you can find commands 2 and 3 on Gerrit page.
refs/changes/$1/$2/$3
:$1
is last two digits of$2
$2
is real Gerrit's change id (displayed in browser)$3
patch set id
See Fixing previous commit to make sure your ammend commit is OK. Then push
your commit.