User:Purodha/git+gerrit
This page is currently a collection of stuff, not even a draft. Do not use it![edit]
One time steps[edit]
Get access[edit]
Follow the instructions to create a developer account, and wait until you have you git-username and access privileges confirmed. Meanwhile:
Set up your local system[edit]
- Install and configure
git
. - Install
git-review]
. - Install
composer
. - Create an SSH key.
- Once you got access, in one go log in and add your public key to:
- Go to your local user shell and tailor your settings:
- To set your automatically invoked editor to
vim
, either of the following commands will do, both are okay, too, depending on your needs. Feel free to choose another editor:
- To set your automatically invoked editor to
export EDITOR=vim git config --global core.editor "vim"
- next…
Install git
following https://www.mediawiki.org/wiki/Gerrit/Tutorial#Setting_up_Git
and gerritgerrit
?
- Either of the following two commands will do, both are okay, too, depending on your needs:
export EDITOR=vim git config --global core.editor "vim"
git config --global user.name 'your-git-username' git config --global user.email 'an-e-mail-adress-of-yours-which-is-also-set-in-gerrit' git config --global gitreview.remote origin
Repeatable tasks[edit]
Check an extension out, amend it, upload your change for review[edit]
Find out the extensions name in git+gerrit, e.g. from
git clone ssh://user-name@gerrit.wikimedia.org:29418/mediawiki/extensions/extension-name.git cd extension-name git review -s git checkout master git pull --rebase git checkout -b "purodha-`~/bin/ymds`" echo " Happy typing!" â cd "$1" git commit --all $* git show HEAD git fetch --all echo " >> now upload changes." git review
Create new branch from current branch[edit]
git checkout -b newbranch
Delete branch[edit]
git branch -D oldbranch
Last changes of last commit after fresh pull[edit]
git diff HEAD^ HEAD
Rebase (committed) patchset[edit]
If you do not have uncommitted changes and you are on branch yourbranch:
git checkout master git pull git checkout yourbranch git rebase master
Restore file to last commit[edit]
git checkout file
Restore all all files to last commit[edit]
git reset --hard
Undo the last commit[edit]
git reset --hard HEAD~1
Get the newest changes from gerrit in your current branch[edit]
cd user-name git checkout target-branch git pull --rebase origin master
This may cause merge conflicts.
Review[edit]
Since folks are tired of debugging python stacktraces and incorrect git-review configuration, some are recommending to use the underlying Gerrit workflow command:
git push origin HEAD:refs/publish/<BRANCH>[/<TOPIC>]
See also[edit]
https://www.mediawiki.org/wiki/Git/Commit_message_guidelines