CINXE.COM
Gerrit/Advanced usage - MediaWiki
<!DOCTYPE html> <html class="client-nojs vector-feature-language-in-header-disabled vector-feature-language-in-main-page-header-disabled vector-feature-sticky-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-feature-night-mode-disabled skin-theme-clientpref-day vector-toc-available" lang="en" dir="ltr"> <head> <meta charset="UTF-8"> <title>Gerrit/Advanced usage - MediaWiki</title> <script>(function(){var className="client-js vector-feature-language-in-header-disabled vector-feature-language-in-main-page-header-disabled vector-feature-sticky-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-feature-night-mode-disabled skin-theme-clientpref-day vector-toc-available";var cookie=document.cookie.match(/(?:^|; )mediawikiwikimwclientpreferences=([^;]+)/);if(cookie){cookie[1].split('%2C').forEach(function(pref){className=className.replace(new RegExp('(^| )'+pref.replace(/-clientpref-\w+$|[^\w-]+/g,'')+'-clientpref-\\w+( |$)'),'$1'+pref+'$2');});}document.documentElement.className=className;}());RLCONF={"wgBreakFrames":false,"wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""], "wgDefaultDateFormat":"dmy","wgMonthNames":["","January","February","March","April","May","June","July","August","September","October","November","December"],"wgRequestId":"20118341-480b-42a6-b3cf-aec0a5877946","wgCanonicalNamespace":"","wgCanonicalSpecialPageName":false,"wgNamespaceNumber":0,"wgPageName":"Gerrit/Advanced_usage","wgTitle":"Gerrit/Advanced usage","wgCurRevisionId":6826076,"wgRevisionId":6826076,"wgArticleId":78737,"wgIsArticle":true,"wgIsRedirect":false,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":["Git","Gerrit"],"wgPageViewLanguage":"en","wgPageContentLanguage":"en","wgPageContentModel":"wikitext","wgRelevantPageName":"Gerrit/Advanced_usage","wgRelevantArticleId":78737,"wgIsProbablyEditable":true,"wgRelevantPageIsProbablyEditable":true,"wgRestrictionEdit":[],"wgRestrictionMove":[],"wgNoticeProject":"mediawiki","wgCiteReferencePreviewsActive":true,"wgMediaViewerOnClick":true,"wgMediaViewerEnabledByDefault":true,"wgVisualEditor":{ "pageLanguageCode":"en","pageLanguageDir":"ltr","pageVariantFallbacks":"en"},"wgMFDisplayWikibaseDescriptions":{"search":true,"watchlist":true,"tagline":false,"nearby":true},"wgWMESchemaEditAttemptStepOversample":false,"wgWMEPageLength":40000,"wgTranslatePageTranslation":"source","wgCentralAuthMobileDomain":false,"wgEditSubmitButtonLabelPublish":true,"wgDiscussionToolsFeaturesEnabled":{"replytool":true,"newtopictool":true,"sourcemodetoolbar":true,"topicsubscription":false,"autotopicsub":false,"visualenhancements":false,"visualenhancements_reply":false,"visualenhancements_pageframe":false},"wgDiscussionToolsFallbackEditMode":"visual","wgULSPosition":"personal","wgULSisCompactLinksEnabled":true,"wgVector2022LanguageInHeader":false,"wgULSisLanguageSelectorEmpty":false,"wgCheckUserClientHintsHeadersJsApi":["brands","architecture","bitness","fullVersionList","mobile","model","platform","platformVersion"]};RLSTATE={"ext.globalCssJs.user.styles":"ready","site.styles":"ready","user.styles": "ready","ext.globalCssJs.user":"ready","user":"ready","user.options":"loading","ext.translate.tag.languages":"ready","ext.pygments":"ready","ext.cite.styles":"ready","ext.discussionTools.init.styles":"ready","oojs-ui-core.styles":"ready","oojs-ui.styles.indicators":"ready","mediawiki.widgets.styles":"ready","oojs-ui-core.icons":"ready","skins.vector.search.codex.styles":"ready","skins.vector.styles":"ready","skins.vector.icons":"ready","ext.translate.edit.documentation.styles":"ready","ext.translate":"ready","ext.wikimediamessages.styles":"ready","ext.visualEditor.desktopArticleTarget.noscript":"ready","ext.uls.pt":"ready","wikibase.client.init":"ready","ext.wikimediaBadges":"ready"};RLPAGEMODULES=["ext.pygments.view","ext.cite.ux-enhancements","mediawiki.page.media","site","mediawiki.page.ready","mediawiki.toc","skins.vector.js","ext.centralNotice.geoIP","ext.centralNotice.startUp","ext.translate.pagetranslation.uls","ext.urlShortener.toolbar","ext.centralauth.centralautologin", "mmv.bootstrap","ext.visualEditor.desktopArticleTarget.init","ext.visualEditor.targetLoader","ext.echo.centralauth","ext.discussionTools.init","ext.eventLogging","ext.wikimediaEvents","ext.navigationTiming","ext.uls.compactlinks","ext.uls.interface","ext.checkUser.clientHints"];</script> <script>(RLQ=window.RLQ||[]).push(function(){mw.loader.impl(function(){return["user.options@12s5i",function($,jQuery,require,module){mw.user.tokens.set({"patrolToken":"+\\","watchToken":"+\\","csrfToken":"+\\"}); }];});});</script> <link rel="stylesheet" href="/w/load.php?lang=en&modules=ext.cite.styles%7Cext.discussionTools.init.styles%7Cext.pygments%2Ctranslate%2CwikimediaBadges%7Cext.translate.edit.documentation.styles%7Cext.translate.tag.languages%7Cext.uls.pt%7Cext.visualEditor.desktopArticleTarget.noscript%7Cext.wikimediamessages.styles%7Cmediawiki.widgets.styles%7Coojs-ui-core.icons%2Cstyles%7Coojs-ui.styles.indicators%7Cskins.vector.icons%2Cstyles%7Cskins.vector.search.codex.styles%7Cwikibase.client.init&only=styles&skin=vector-2022"> <script async="" src="/w/load.php?lang=en&modules=startup&only=scripts&raw=1&skin=vector-2022"></script> <meta name="ResourceLoaderDynamicStyles" content=""> <link rel="stylesheet" href="/w/load.php?lang=en&modules=site.styles&only=styles&skin=vector-2022"> <meta name="generator" content="MediaWiki 1.44.0-wmf.5"> <meta name="referrer" content="origin"> <meta name="referrer" content="origin-when-cross-origin"> <meta name="robots" content="max-image-preview:standard"> <meta name="format-detection" content="telephone=no"> <meta property="og:image" content="https://upload.wikimedia.org/wikipedia/commons/thumb/0/0e/GitWorkflow.svg/1200px-GitWorkflow.svg.png"> <meta property="og:image:width" content="1200"> <meta property="og:image:height" content="918"> <meta property="og:image" content="https://upload.wikimedia.org/wikipedia/commons/thumb/0/0e/GitWorkflow.svg/800px-GitWorkflow.svg.png"> <meta property="og:image:width" content="800"> <meta property="og:image:height" content="612"> <meta property="og:image" content="https://upload.wikimedia.org/wikipedia/commons/thumb/0/0e/GitWorkflow.svg/640px-GitWorkflow.svg.png"> <meta property="og:image:width" content="640"> <meta property="og:image:height" content="490"> <meta name="viewport" content="width=1120"> <meta property="og:site_name" content="MediaWiki"> <meta property="og:title" content="Gerrit/Advanced usage - MediaWiki"> <meta property="og:type" content="website"> <link rel="preconnect" href="//upload.wikimedia.org"> <link rel="alternate" media="only screen and (max-width: 640px)" href="//m.mediawiki.org/wiki/Gerrit/Advanced_usage"> <link rel="alternate" type="application/x-wiki" title="Edit" href="/w/index.php?title=Gerrit/Advanced_usage&action=edit"> <link rel="apple-touch-icon" href="/static/apple-touch/mediawiki.png"> <link rel="icon" href="/static/favicon/mediawiki.ico"> <link rel="search" type="application/opensearchdescription+xml" href="/w/rest.php/v1/search" title="MediaWiki (en)"> <link rel="EditURI" type="application/rsd+xml" href="//www.mediawiki.org/w/api.php?action=rsd"> <link rel="canonical" href="https://www.mediawiki.org/wiki/Gerrit/Advanced_usage"> <link rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/"> <link rel="alternate" type="application/atom+xml" title="MediaWiki Atom feed" href="/w/index.php?title=Special:RecentChanges&feed=atom"> <link rel="dns-prefetch" href="//meta.wikimedia.org" /> <link rel="dns-prefetch" href="//login.wikimedia.org"> </head> <body class="ext-discussiontools-replytool-enabled ext-discussiontools-newtopictool-enabled ext-discussiontools-sourcemodetoolbar-enabled skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject mw-editable page-Gerrit_Advanced_usage rootpage-Gerrit skin-vector-2022 action-view"><a class="mw-jump-link" href="#bodyContent">Jump to content</a> <div class="vector-header-container"> <header class="vector-header mw-header"> <div class="vector-header-start"> <nav class="vector-main-menu-landmark" aria-label="Site"> <div id="vector-main-menu-dropdown" class="vector-dropdown vector-main-menu-dropdown vector-button-flush-left vector-button-flush-right" > <input type="checkbox" id="vector-main-menu-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-main-menu-dropdown" class="vector-dropdown-checkbox " aria-label="Main menu" > <label id="vector-main-menu-dropdown-label" for="vector-main-menu-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-menu mw-ui-icon-wikimedia-menu"></span> <span class="vector-dropdown-label-text">Main menu</span> </label> <div class="vector-dropdown-content"> <div id="vector-main-menu-unpinned-container" class="vector-unpinned-container"> <div id="vector-main-menu" class="vector-main-menu vector-pinnable-element"> <div class="vector-pinnable-header vector-main-menu-pinnable-header vector-pinnable-header-unpinned" data-feature-name="main-menu-pinned" data-pinnable-element-id="vector-main-menu" data-pinned-container-id="vector-main-menu-pinned-container" data-unpinned-container-id="vector-main-menu-unpinned-container" > <div class="vector-pinnable-header-label">Main menu</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-main-menu.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-main-menu.unpin">hide</button> </div> <div id="p-navigation" class="vector-menu mw-portlet mw-portlet-navigation" > <div class="vector-menu-heading"> Navigation </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-mainpage-description" class="mw-list-item"><a href="/wiki/MediaWiki" title="Visit the main page [z]" accesskey="z"><span>Main page</span></a></li><li id="n-mw-download" class="mw-list-item"><a href="/wiki/Download"><span>Get MediaWiki</span></a></li><li id="n-mw-extensions" class="mw-list-item"><a href="/wiki/Special:MyLanguage/Category:Extensions"><span>Get extensions</span></a></li><li id="n-blog-text" class="mw-list-item"><a href="https://techblog.wikimedia.org/"><span>Tech blog</span></a></li><li id="n-mw-contribute" class="mw-list-item"><a href="/wiki/Special:MyLanguage/How_to_contribute"><span>Contribute</span></a></li> </ul> </div> </div> <div id="p-support" class="vector-menu mw-portlet mw-portlet-support" > <div class="vector-menu-heading"> Support </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-help" class="mw-list-item"><a href="/wiki/Special:MyLanguage/Help:Contents" title="The place to find out"><span>User help</span></a></li><li id="n-mw-faq" class="mw-list-item"><a href="/wiki/Special:MyLanguage/Manual:FAQ"><span>FAQ</span></a></li><li id="n-mw-manual" class="mw-list-item"><a href="/wiki/Special:MyLanguage/Manual:Contents"><span>Technical manual</span></a></li><li id="n-mw-supportdesk" class="mw-list-item"><a href="/wiki/Project:Support_desk"><span>Support desk</span></a></li><li id="n-mw-communication" class="mw-list-item"><a href="/wiki/Special:MyLanguage/Communication"><span>Communication</span></a></li> </ul> </div> </div> <div id="p-development" class="vector-menu mw-portlet mw-portlet-development" > <div class="vector-menu-heading"> Development </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-mw-developerportal" class="mw-list-item"><a href="https://developer.wikimedia.org/"><span>Developer portal</span></a></li><li id="n-svn-statistics" class="mw-list-item"><a href="/wiki/Development_statistics"><span>Code statistics</span></a></li> </ul> </div> </div> <div id="p-mediawiki.org" class="vector-menu mw-portlet mw-portlet-mediawiki_org" > <div class="vector-menu-heading"> mediawiki.org </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-portal" class="mw-list-item"><a href="/wiki/Project:Help" title="About the project, what you can do, where to find things"><span>Community portal</span></a></li><li id="n-recentchanges" class="mw-list-item"><a href="/wiki/Special:RecentChanges" title="A list of recent changes in the wiki [r]" accesskey="r"><span>Recent changes</span></a></li><li id="n-mw-translate" class="mw-list-item"><a href="/wiki/Special:LanguageStats"><span>Translate content</span></a></li><li id="n-randompage" class="mw-list-item"><a href="/wiki/Special:Random" title="Load a random page [x]" accesskey="x"><span>Random page</span></a></li><li id="n-mw-discussion" class="mw-list-item"><a href="/wiki/Project:Village_Pump"><span>Village pump</span></a></li><li id="n-Sandboxlink-portlet-label" class="mw-list-item"><a href="/wiki/Project:Sandbox"><span>Sandbox</span></a></li> </ul> </div> </div> <div id="p-lang" class="vector-menu mw-portlet mw-portlet-lang" > <div class="vector-menu-heading"> In other languages </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> <div class="after-portlet after-portlet-lang"><span class="wb-langlinks-add wb-langlinks-link"><a href="https://www.wikidata.org/wiki/Special:NewItem?site=mediawikiwiki&page=Gerrit%2FAdvanced+usage" title="Add interlanguage links" class="wbc-editpage">Add links</a></span></div> </div> </div> </div> </div> </div> </div> </nav> <a href="/wiki/MediaWiki" class="mw-logo"> <img class="mw-logo-icon" src="/static/images/icons/mediawikiwiki.svg" alt="" aria-hidden="true" height="50" width="50"> <span class="mw-logo-container skin-invert"> <img class="mw-logo-wordmark" alt="MediaWiki" src="/static/images/mobile/copyright/mediawikiwiki-wordmark.svg" style="width: 7.5em; height: 1.125em;"> </span> </a> </div> <div class="vector-header-end"> <div id="p-search" role="search" class="vector-search-box-vue vector-search-box-collapses vector-search-box-show-thumbnail vector-search-box-auto-expand-width vector-search-box"> <a href="/wiki/Special:Search" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only search-toggle" title="Search MediaWiki [f]" accesskey="f"><span class="vector-icon mw-ui-icon-search mw-ui-icon-wikimedia-search"></span> <span>Search</span> </a> <div class="vector-typeahead-search-container"> <div class="cdx-typeahead-search cdx-typeahead-search--show-thumbnail cdx-typeahead-search--auto-expand-width"> <form action="/w/index.php" id="searchform" class="cdx-search-input cdx-search-input--has-end-button"> <div id="simpleSearch" class="cdx-search-input__input-wrapper" data-search-loc="header-moved"> <div class="cdx-text-input cdx-text-input--has-start-icon"> <input class="cdx-text-input__input" type="search" name="search" placeholder="Search MediaWiki" aria-label="Search MediaWiki" autocapitalize="sentences" title="Search MediaWiki [f]" accesskey="f" id="searchInput" > <span class="cdx-text-input__icon cdx-text-input__start-icon"></span> </div> <input type="hidden" name="title" value="Special:Search"> </div> <button class="cdx-button cdx-search-input__end-button">Search</button> </form> </div> </div> </div> <nav class="vector-user-links vector-user-links-wide" aria-label="Personal tools"> <div class="vector-user-links-main"> <div id="p-vector-user-menu-preferences" class="vector-menu mw-portlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-uls" class="mw-list-item active user-links-collapsible-item"><a data-mw="interface" href="#" class="uls-trigger cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet"><span class="vector-icon mw-ui-icon-wikimedia-language mw-ui-icon-wikimedia-wikimedia-language"></span> <span>English</span></a> </li> </ul> </div> </div> <div id="p-vector-user-menu-userpage" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <nav class="vector-appearance-landmark" aria-label="Appearance"> <div id="vector-appearance-dropdown" class="vector-dropdown " title="Change the appearance of the page's font size, width, and color" > <input type="checkbox" id="vector-appearance-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-appearance-dropdown" class="vector-dropdown-checkbox " aria-label="Appearance" > <label id="vector-appearance-dropdown-label" for="vector-appearance-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-appearance mw-ui-icon-wikimedia-appearance"></span> <span class="vector-dropdown-label-text">Appearance</span> </label> <div class="vector-dropdown-content"> <div id="vector-appearance-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <div id="p-vector-user-menu-notifications" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <div id="p-vector-user-menu-overflow" class="vector-menu mw-portlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-sitesupport-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="https://donate.wikimedia.org/?wmf_source=donate&wmf_medium=sidebar&wmf_campaign=www.mediawiki.org&uselang=en" class=""><span>Donate</span></a> </li> <li id="pt-createaccount-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="/w/index.php?title=Special:CreateAccount&returnto=Gerrit%2FAdvanced+usage" title="You are encouraged to create an account and log in; however, it is not mandatory" class=""><span>Create account</span></a> </li> <li id="pt-login-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="/w/index.php?title=Special:UserLogin&returnto=Gerrit%2FAdvanced+usage" title="You are encouraged to log in; however, it is not mandatory [o]" accesskey="o" class=""><span>Log in</span></a> </li> </ul> </div> </div> </div> <div id="vector-user-links-dropdown" class="vector-dropdown vector-user-menu vector-button-flush-right vector-user-menu-logged-out" title="More options" > <input type="checkbox" id="vector-user-links-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-user-links-dropdown" class="vector-dropdown-checkbox " aria-label="Personal tools" > <label id="vector-user-links-dropdown-label" for="vector-user-links-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-ellipsis mw-ui-icon-wikimedia-ellipsis"></span> <span class="vector-dropdown-label-text">Personal tools</span> </label> <div class="vector-dropdown-content"> <div id="p-personal" class="vector-menu mw-portlet mw-portlet-personal user-links-collapsible-item" title="User menu" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-sitesupport" class="user-links-collapsible-item mw-list-item"><a href="https://donate.wikimedia.org/?wmf_source=donate&wmf_medium=sidebar&wmf_campaign=www.mediawiki.org&uselang=en"><span>Donate</span></a></li><li id="pt-createaccount" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Special:CreateAccount&returnto=Gerrit%2FAdvanced+usage" title="You are encouraged to create an account and log in; however, it is not mandatory"><span class="vector-icon mw-ui-icon-userAdd mw-ui-icon-wikimedia-userAdd"></span> <span>Create account</span></a></li><li id="pt-login" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Special:UserLogin&returnto=Gerrit%2FAdvanced+usage" title="You are encouraged to log in; however, it is not mandatory [o]" accesskey="o"><span class="vector-icon mw-ui-icon-logIn mw-ui-icon-wikimedia-logIn"></span> <span>Log in</span></a></li> </ul> </div> </div> <div id="p-user-menu-anon-editor" class="vector-menu mw-portlet mw-portlet-user-menu-anon-editor" > <div class="vector-menu-heading"> Pages for logged out editors <a href="/wiki/Help:Introduction" aria-label="Learn more about editing"><span>learn more</span></a> </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-anoncontribs" class="mw-list-item"><a href="/wiki/Special:MyContributions" title="A list of edits made from this IP address [y]" accesskey="y"><span>Contributions</span></a></li><li id="pt-anontalk" class="mw-list-item"><a href="/wiki/Special:MyTalk" title="Discussion about edits from this IP address [n]" accesskey="n"><span>Talk</span></a></li> </ul> </div> </div> </div> </div> </nav> </div> </header> </div> <div class="mw-page-container"> <div class="mw-page-container-inner"> <div class="vector-sitenotice-container"> <div id="siteNotice"><!-- CentralNotice --></div> </div> <div class="vector-column-start"> <div class="vector-main-menu-container"> <div id="mw-navigation"> <nav id="mw-panel" class="vector-main-menu-landmark" aria-label="Site"> <div id="vector-main-menu-pinned-container" class="vector-pinned-container"> </div> </nav> </div> </div> <div class="vector-sticky-pinned-container"> <nav id="mw-panel-toc" aria-label="Contents" data-event-name="ui.sidebar-toc" class="mw-table-of-contents-container vector-toc-landmark"> <div id="vector-toc-pinned-container" class="vector-pinned-container"> <div id="vector-toc" class="vector-toc vector-pinnable-element"> <div class="vector-pinnable-header vector-toc-pinnable-header vector-pinnable-header-pinned" data-feature-name="toc-pinned" data-pinnable-element-id="vector-toc" > <h2 class="vector-pinnable-header-label">Contents</h2> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-toc.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-toc.unpin">hide</button> </div> <ul class="vector-toc-contents" id="mw-panel-toc-list"> <li id="toc-mw-content-text" class="vector-toc-list-item vector-toc-level-1"> <a href="#" class="vector-toc-link"> <div class="vector-toc-text">Beginning</div> </a> </li> <li id="toc-Warning" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Warning"> <div class="vector-toc-text"> <span class="vector-toc-numb">1</span> <span>Warning</span> </div> </a> <ul id="toc-Warning-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Installation" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Installation"> <div class="vector-toc-text"> <span class="vector-toc-numb">2</span> <span>Installation</span> </div> </a> <button aria-controls="toc-Installation-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle Installation subsection</span> </button> <ul id="toc-Installation-sublist" class="vector-toc-list"> <li id="toc-Setup_SSH_shortcut_(optional)" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Setup_SSH_shortcut_(optional)"> <div class="vector-toc-text"> <span class="vector-toc-numb">2.1</span> <span>Setup SSH shortcut (optional)</span> </div> </a> <ul id="toc-Setup_SSH_shortcut_(optional)-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Submitting_patches" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Submitting_patches"> <div class="vector-toc-text"> <span class="vector-toc-numb">3</span> <span>Submitting patches</span> </div> </a> <span class="ext-discussiontools-init-sidebar-meta">1 comment</span> <button aria-controls="toc-Submitting_patches-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle Submitting patches subsection</span> </button> <ul id="toc-Submitting_patches-sublist" class="vector-toc-list"> <li id="toc-Setting_up_a_repository_for_git-remote" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Setting_up_a_repository_for_git-remote"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.1</span> <span>Setting up a repository for git-remote</span> </div> </a> <ul id="toc-Setting_up_a_repository_for_git-remote-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Howto_-_Merging_your_amend_back_into_your_branch" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Howto_-_Merging_your_amend_back_into_your_branch"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.2</span> <span>Howto - Merging your amend back into your branch</span> </div> </a> <ul id="toc-Howto_-_Merging_your_amend_back_into_your_branch-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Submitting_a_change_to_a_branch_for_review_("backporting")" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Submitting_a_change_to_a_branch_for_review_("backporting")"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.3</span> <span>Submitting a change to a branch for review ("backporting")</span> </div> </a> <ul id="toc-Submitting_a_change_to_a_branch_for_review_("backporting")-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Acting_on_remote_branches" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Acting_on_remote_branches"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.4</span> <span>Acting on remote branches</span> </div> </a> <ul id="toc-Acting_on_remote_branches-sublist" class="vector-toc-list"> <li id="toc-Pushing_having_used_automatic_setup" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Pushing_having_used_automatic_setup"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.4.1</span> <span>Pushing having used automatic setup</span> </div> </a> <ul id="toc-Pushing_having_used_automatic_setup-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Pushing_having_used_manual_(Windows)_setup" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Pushing_having_used_manual_(Windows)_setup"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.4.2</span> <span>Pushing having used manual (Windows) setup</span> </div> </a> <ul id="toc-Pushing_having_used_manual_(Windows)_setup-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Committing_to_non_master" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Committing_to_non_master"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.5</span> <span>Committing to non master</span> </div> </a> <ul id="toc-Committing_to_non_master-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Partial_revert_of_previous_commit" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Partial_revert_of_previous_commit"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.6</span> <span>Partial revert of previous commit</span> </div> </a> <ul id="toc-Partial_revert_of_previous_commit-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Unlink_bogus_dependencies_(rebase_changes)" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Unlink_bogus_dependencies_(rebase_changes)"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.7</span> <span>Unlink bogus dependencies (rebase changes)</span> </div> </a> <ul id="toc-Unlink_bogus_dependencies_(rebase_changes)-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Create_a_dependency" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Create_a_dependency"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.8</span> <span>Create a dependency</span> </div> </a> <ul id="toc-Create_a_dependency-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Cross-project_dependencies" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Cross-project_dependencies"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.9</span> <span>Cross-project dependencies</span> </div> </a> <ul id="toc-Cross-project_dependencies-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Splitting_a_commit_into_smaller_ones" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Splitting_a_commit_into_smaller_ones"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.10</span> <span>Splitting a commit into smaller ones</span> </div> </a> <ul id="toc-Splitting_a_commit_into_smaller_ones-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Removing_your_local_branch_after_submitting_your_change_into_Gerrit" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Removing_your_local_branch_after_submitting_your_change_into_Gerrit"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.11</span> <span>Removing your local branch after submitting your change into Gerrit</span> </div> </a> <ul id="toc-Removing_your_local_branch_after_submitting_your_change_into_Gerrit-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Merging_a_submodule_into_a_parent_project" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Merging_a_submodule_into_a_parent_project"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.12</span> <span>Merging a submodule into a parent project</span> </div> </a> <ul id="toc-Merging_a_submodule_into_a_parent_project-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Using_a_personal_sandbox_for_personal_branches" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Using_a_personal_sandbox_for_personal_branches"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.13</span> <span>Using a personal sandbox for personal branches</span> </div> </a> <ul id="toc-Using_a_personal_sandbox_for_personal_branches-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Troubleshooting" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Troubleshooting"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.14</span> <span>Troubleshooting</span> </div> </a> <ul id="toc-Troubleshooting-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Working_on_an_existing_change_set" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Working_on_an_existing_change_set"> <div class="vector-toc-text"> <span class="vector-toc-numb">4</span> <span>Working on an existing change set</span> </div> </a> <button aria-controls="toc-Working_on_an_existing_change_set-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle Working on an existing change set subsection</span> </button> <ul id="toc-Working_on_an_existing_change_set-sublist" class="vector-toc-list"> <li id="toc-Manually_rebase_(on_a_branch)" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Manually_rebase_(on_a_branch)"> <div class="vector-toc-text"> <span class="vector-toc-numb">4.1</span> <span>Manually rebase (on a branch)</span> </div> </a> <ul id="toc-Manually_rebase_(on_a_branch)-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Manually_rebase_(on_parent)" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Manually_rebase_(on_parent)"> <div class="vector-toc-text"> <span class="vector-toc-numb">4.2</span> <span>Manually rebase (on parent)</span> </div> </a> <ul id="toc-Manually_rebase_(on_parent)-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Reviewing_code" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Reviewing_code"> <div class="vector-toc-text"> <span class="vector-toc-numb">5</span> <span>Reviewing code</span> </div> </a> <button aria-controls="toc-Reviewing_code-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle Reviewing code subsection</span> </button> <ul id="toc-Reviewing_code-sublist" class="vector-toc-list"> <li id="toc-Viewing_and_commenting_on_code" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Viewing_and_commenting_on_code"> <div class="vector-toc-text"> <span class="vector-toc-numb">5.1</span> <span>Viewing and commenting on code</span> </div> </a> <ul id="toc-Viewing_and_commenting_on_code-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-How_to_comment_on,_review,_and_merge_code_in_Eclipse" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#How_to_comment_on,_review,_and_merge_code_in_Eclipse"> <div class="vector-toc-text"> <span class="vector-toc-numb">5.2</span> <span>How to comment on, review, and merge code in Eclipse</span> </div> </a> <ul id="toc-How_to_comment_on,_review,_and_merge_code_in_Eclipse-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-How_to_review_and_merge_code_via_command_line" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#How_to_review_and_merge_code_via_command_line"> <div class="vector-toc-text"> <span class="vector-toc-numb">5.3</span> <span>How to review and merge code via command line</span> </div> </a> <ul id="toc-How_to_review_and_merge_code_via_command_line-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Mass-approving_changes_across_repositories" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Mass-approving_changes_across_repositories"> <div class="vector-toc-text"> <span class="vector-toc-numb">5.4</span> <span>Mass-approving changes across repositories</span> </div> </a> <ul id="toc-Mass-approving_changes_across_repositories-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Troubleshooting_2" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Troubleshooting_2"> <div class="vector-toc-text"> <span class="vector-toc-numb">5.5</span> <span>Troubleshooting</span> </div> </a> <ul id="toc-Troubleshooting_2-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-How_to_create_a_repository_("Gerrit_project")" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#How_to_create_a_repository_("Gerrit_project")"> <div class="vector-toc-text"> <span class="vector-toc-numb">6</span> <span>How to create a repository ("Gerrit project")</span> </div> </a> <ul id="toc-How_to_create_a_repository_("Gerrit_project")-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Other_tips" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Other_tips"> <div class="vector-toc-text"> <span class="vector-toc-numb">7</span> <span>Other tips</span> </div> </a> <button aria-controls="toc-Other_tips-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle Other tips subsection</span> </button> <ul id="toc-Other_tips-sublist" class="vector-toc-list"> <li id="toc-Gerrit_project_dashboard" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Gerrit_project_dashboard"> <div class="vector-toc-text"> <span class="vector-toc-numb">7.1</span> <span>Gerrit project dashboard</span> </div> </a> <ul id="toc-Gerrit_project_dashboard-sublist" class="vector-toc-list"> <li id="toc-Manage_a_team_dashboard" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Manage_a_team_dashboard"> <div class="vector-toc-text"> <span class="vector-toc-numb">7.1.1</span> <span>Manage a team dashboard</span> </div> </a> <ul id="toc-Manage_a_team_dashboard-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Add_team_dashboard_to_"Your"_menu" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Add_team_dashboard_to_"Your"_menu"> <div class="vector-toc-text"> <span class="vector-toc-numb">7.1.2</span> <span>Add team dashboard to "Your" menu</span> </div> </a> <ul id="toc-Add_team_dashboard_to_"Your"_menu-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Bookmarklet_to_hide_jenkins-bot_comments" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Bookmarklet_to_hide_jenkins-bot_comments"> <div class="vector-toc-text"> <span class="vector-toc-numb">7.2</span> <span>Bookmarklet to hide jenkins-bot comments</span> </div> </a> <ul id="toc-Bookmarklet_to_hide_jenkins-bot_comments-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Code_Review_links" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Code_Review_links"> <div class="vector-toc-text"> <span class="vector-toc-numb">7.3</span> <span>Code Review links</span> </div> </a> <ul id="toc-Code_Review_links-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Gerrit_review_scores" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Gerrit_review_scores"> <div class="vector-toc-text"> <span class="vector-toc-numb">7.4</span> <span>Gerrit review scores</span> </div> </a> <ul id="toc-Gerrit_review_scores-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-ssh_proxy_to_gerrit" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#ssh_proxy_to_gerrit"> <div class="vector-toc-text"> <span class="vector-toc-numb">7.5</span> <span>ssh proxy to gerrit</span> </div> </a> <ul id="toc-ssh_proxy_to_gerrit-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Linking_Gerrit_URLs_from_Wikimedia_wikis_using_internal_link_syntax" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Linking_Gerrit_URLs_from_Wikimedia_wikis_using_internal_link_syntax"> <div class="vector-toc-text"> <span class="vector-toc-numb">7.6</span> <span>Linking Gerrit URLs from Wikimedia wikis using internal link syntax</span> </div> </a> <ul id="toc-Linking_Gerrit_URLs_from_Wikimedia_wikis_using_internal_link_syntax-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Changing_the_user_associated_with_a_commit" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Changing_the_user_associated_with_a_commit"> <div class="vector-toc-text"> <span class="vector-toc-numb">7.7</span> <span>Changing the user associated with a commit</span> </div> </a> <ul id="toc-Changing_the_user_associated_with_a_commit-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-See_also" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#See_also"> <div class="vector-toc-text"> <span class="vector-toc-numb">8</span> <span>See also</span> </div> </a> <ul id="toc-See_also-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Notes" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Notes"> <div class="vector-toc-text"> <span class="vector-toc-numb">9</span> <span>Notes</span> </div> </a> <ul id="toc-Notes-sublist" class="vector-toc-list"> </ul> </li> </ul> </div> </div> </nav> </div> </div> <div class="mw-content-container"> <main id="content" class="mw-body"> <header class="mw-body-header vector-page-titlebar"> <nav aria-label="Contents" class="vector-toc-landmark"> <div id="vector-page-titlebar-toc" class="vector-dropdown vector-page-titlebar-toc vector-button-flush-left" > <input type="checkbox" id="vector-page-titlebar-toc-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-page-titlebar-toc" class="vector-dropdown-checkbox " aria-label="Toggle the table of contents" > <label id="vector-page-titlebar-toc-label" for="vector-page-titlebar-toc-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-listBullet mw-ui-icon-wikimedia-listBullet"></span> <span class="vector-dropdown-label-text">Toggle the table of contents</span> </label> <div class="vector-dropdown-content"> <div id="vector-page-titlebar-toc-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <h1 id="firstHeading" class="firstHeading mw-first-heading"><span class="mw-page-title-main">Gerrit/Advanced usage</span></h1> <div class="mw-indicators"> </div> </header> <div class="vector-page-toolbar"> <div class="vector-page-toolbar-container"> <div id="left-navigation"> <nav aria-label="Namespaces"> <div id="p-associated-pages" class="vector-menu vector-menu-tabs mw-portlet mw-portlet-associated-pages" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-nstab-main" class="selected vector-tab-noicon mw-list-item"><a href="/wiki/Gerrit/Advanced_usage" title="View the content page [c]" accesskey="c"><span>Page</span></a></li><li id="ca-talk" class="vector-tab-noicon mw-list-item"><a href="/wiki/Talk:Gerrit/Advanced_usage" rel="discussion" title="Discussion about the content page [t]" accesskey="t"><span>Discussion</span></a></li> </ul> </div> </div> <div id="vector-variants-dropdown" class="vector-dropdown emptyPortlet" > <input type="checkbox" id="vector-variants-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-variants-dropdown" class="vector-dropdown-checkbox " aria-label="Change language variant" > <label id="vector-variants-dropdown-label" for="vector-variants-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet" aria-hidden="true" ><span class="vector-dropdown-label-text">English</span> </label> <div class="vector-dropdown-content"> <div id="p-variants" class="vector-menu mw-portlet mw-portlet-variants emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> </div> </div> </nav> </div> <div id="right-navigation" class="vector-collapsible"> <nav aria-label="Views"> <div id="p-views" class="vector-menu vector-menu-tabs mw-portlet mw-portlet-views" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-view" class="selected vector-tab-noicon mw-list-item"><a href="/wiki/Gerrit/Advanced_usage"><span>Read</span></a></li><li id="ca-edit" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit" title="Edit the source code of this page [e]" accesskey="e"><span>Edit</span></a></li><li id="ca-history" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Gerrit/Advanced_usage&action=history" title="Past revisions of this page [h]" accesskey="h"><span>View history</span></a></li> </ul> </div> </div> </nav> <nav class="vector-page-tools-landmark" aria-label="Page tools"> <div id="vector-page-tools-dropdown" class="vector-dropdown vector-page-tools-dropdown" > <input type="checkbox" id="vector-page-tools-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-page-tools-dropdown" class="vector-dropdown-checkbox " aria-label="Tools" > <label id="vector-page-tools-dropdown-label" for="vector-page-tools-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet" aria-hidden="true" ><span class="vector-dropdown-label-text">Tools</span> </label> <div class="vector-dropdown-content"> <div id="vector-page-tools-unpinned-container" class="vector-unpinned-container"> <div id="vector-page-tools" class="vector-page-tools vector-pinnable-element"> <div class="vector-pinnable-header vector-page-tools-pinnable-header vector-pinnable-header-unpinned" data-feature-name="page-tools-pinned" data-pinnable-element-id="vector-page-tools" data-pinned-container-id="vector-page-tools-pinned-container" data-unpinned-container-id="vector-page-tools-unpinned-container" > <div class="vector-pinnable-header-label">Tools</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-page-tools.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-page-tools.unpin">hide</button> </div> <div id="p-cactions" class="vector-menu mw-portlet mw-portlet-cactions emptyPortlet vector-has-collapsible-items" title="More options" > <div class="vector-menu-heading"> Actions </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-more-view" class="selected vector-more-collapsible-item mw-list-item"><a href="/wiki/Gerrit/Advanced_usage"><span>Read</span></a></li><li id="ca-more-edit" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit" title="Edit the source code of this page [e]" accesskey="e"><span>Edit</span></a></li><li id="ca-more-history" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Gerrit/Advanced_usage&action=history"><span>View history</span></a></li> </ul> </div> </div> <div id="p-tb" class="vector-menu mw-portlet mw-portlet-tb" > <div class="vector-menu-heading"> General </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="t-whatlinkshere" class="mw-list-item"><a href="/wiki/Special:WhatLinksHere/Gerrit/Advanced_usage" title="A list of all wiki pages that link here [j]" accesskey="j"><span>What links here</span></a></li><li id="t-recentchangeslinked" class="mw-list-item"><a href="/wiki/Special:RecentChangesLinked/Gerrit/Advanced_usage" rel="nofollow" title="Recent changes in pages linked from this page [k]" accesskey="k"><span>Related changes</span></a></li><li id="t-upload" class="mw-list-item"><a href="//commons.wikimedia.org/wiki/Special:UploadWizard" title="Upload files [u]" accesskey="u"><span>Upload file</span></a></li><li id="t-specialpages" class="mw-list-item"><a href="/wiki/Special:SpecialPages" title="A list of all special pages [q]" accesskey="q"><span>Special pages</span></a></li><li id="t-permalink" class="mw-list-item"><a href="/w/index.php?title=Gerrit/Advanced_usage&oldid=6826076" title="Permanent link to this revision of this page"><span>Permanent link</span></a></li><li id="t-info" class="mw-list-item"><a href="/w/index.php?title=Gerrit/Advanced_usage&action=info" title="More information about this page"><span>Page information</span></a></li><li id="t-cite" class="mw-list-item"><a href="/w/index.php?title=Special:CiteThisPage&page=Gerrit%2FAdvanced_usage&id=6826076&wpFormIdentifier=titleform" title="Information on how to cite this page"><span>Cite this page</span></a></li><li id="t-urlshortener" class="mw-list-item"><a href="/w/index.php?title=Special:UrlShortener&url=https%3A%2F%2Fwww.mediawiki.org%2Fwiki%2FGerrit%2FAdvanced_usage"><span>Get shortened URL</span></a></li><li id="t-urlshortener-qrcode" class="mw-list-item"><a href="/w/index.php?title=Special:QrCode&url=https%3A%2F%2Fwww.mediawiki.org%2Fwiki%2FGerrit%2FAdvanced_usage"><span>Download QR code</span></a></li> </ul> </div> </div> <div id="p-coll-print_export" class="vector-menu mw-portlet mw-portlet-coll-print_export" > <div class="vector-menu-heading"> Print/export </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="coll-create_a_book" class="mw-list-item"><a href="/w/index.php?title=Special:Book&bookcmd=book_creator&referer=Gerrit%2FAdvanced+usage"><span>Create a book</span></a></li><li id="coll-download-as-rl" class="mw-list-item"><a href="/w/index.php?title=Special:DownloadAsPdf&page=Gerrit%2FAdvanced_usage&action=show-download-screen"><span>Download as PDF</span></a></li><li id="t-print" class="mw-list-item"><a href="/w/index.php?title=Gerrit/Advanced_usage&printable=yes" title="Printable version of this page [p]" accesskey="p"><span>Printable version</span></a></li> </ul> </div> </div> <div id="p-wikibase-otherprojects" class="vector-menu mw-portlet mw-portlet-wikibase-otherprojects emptyPortlet" > <div class="vector-menu-heading"> In other projects </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> </div> </div> </div> </div> </nav> </div> </div> </div> <div class="vector-column-end"> <div class="vector-sticky-pinned-container"> <nav class="vector-page-tools-landmark" aria-label="Page tools"> <div id="vector-page-tools-pinned-container" class="vector-pinned-container"> </div> </nav> <nav class="vector-appearance-landmark" aria-label="Appearance"> <div id="vector-appearance-pinned-container" class="vector-pinned-container"> <div id="vector-appearance" class="vector-appearance vector-pinnable-element"> <div class="vector-pinnable-header vector-appearance-pinnable-header vector-pinnable-header-pinned" data-feature-name="appearance-pinned" data-pinnable-element-id="vector-appearance" data-pinned-container-id="vector-appearance-pinned-container" data-unpinned-container-id="vector-appearance-unpinned-container" > <div class="vector-pinnable-header-label">Appearance</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-appearance.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-appearance.unpin">hide</button> </div> </div> </div> </nav> </div> </div> <div id="bodyContent" class="vector-body" aria-labelledby="firstHeading" data-mw-ve-target-container> <div class="vector-body-before-content"> <div id="siteSub" class="noprint">From mediawiki.org</div> </div> <div id="contentSub"><div id="mw-content-subtitle"><div class="subpages">< <bdi dir="ltr"><a href="/wiki/Special:MyLanguage/Gerrit" title="Special:MyLanguage/Gerrit">Gerrit</a></bdi></div></div></div> <div id="mw-content-text" class="mw-body-content"><div class="mw-pt-translate-header noprint nomobile" dir="ltr" lang="en"><a href="/w/index.php?title=Special:Translate&group=page-Gerrit%2FAdvanced+usage&action=page&filter=&action_source=translate_page" title="Special:Translate">Translate this page</a></div><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr"><div class="mw-pt-languages noprint navigation-not-searchable" lang="en" dir="ltr"><div class="mw-pt-languages-label">Languages:</div><ul class="mw-pt-languages-list"><li><a href="/wiki/Gerrit/Advanced_usage/de" class="mw-pt-progress mw-pt-progress--low" title="Gerrit/Fortgeschrittene Verwendung (4% translated)" lang="de" dir="ltr">Deutsch</a></li> <li><span class="mw-pt-languages-ui mw-pt-languages-selected mw-pt-progress mw-pt-progress--complete" lang="en" dir="ltr">English</span></li> <li><a href="/wiki/Gerrit/Advanced_usage/ha" class="mw-pt-progress mw-pt-progress--low" title="Gerrit/Advanced usage/ha (3% translated)" lang="ha" dir="ltr">Hausa</a></li> <li><a href="/wiki/Gerrit/Advanced_usage/fr" class="mw-pt-progress mw-pt-progress--high" title="Gerrit/Utilisation avancée (97% translated)" lang="fr" dir="ltr">français</a></li> <li><a href="/wiki/Gerrit/Advanced_usage/cs" class="mw-pt-progress mw-pt-progress--high" title="Gerrit/Pokročilé použití (98% translated)" lang="cs" dir="ltr">čeština</a></li> <li><a href="/wiki/Gerrit/Advanced_usage/ru" class="mw-pt-progress mw-pt-progress--low" title="Gerrit/Расширенное использование (2% translated)" lang="ru" dir="ltr">русский</a></li> <li><a href="/wiki/Gerrit/Advanced_usage/he" class="mw-pt-progress mw-pt-progress--low" title="Gerrit/Advanced usage/he (0% translated)" lang="he" dir="rtl">עברית</a></li> <li><a href="/wiki/Gerrit/Advanced_usage/ja" class="mw-pt-progress mw-pt-progress--low" title="Gerrit/高度な使用法 (5% translated)" lang="ja" dir="ltr">日本語</a></li></ul></div> <style data-mw-deduplicate="TemplateStyles:r6605224">.mw-parser-output .tpl-sidebar{background-color:var(--background-color-interactive-subtle,#f8f9fa);border:1px solid var(--border-color-divider,#a2a9b1);color:var(--color-base,#202122);width:22em;padding:.2em;text-align:center;line-height:1.4em;font-size:88%}.mw-parser-output .tpl-sidebar-pagedir-ltr,.mw-parser-output .tpl-sidebar.tpl-sidebar-floatright{float:right;clear:right;margin:.5em 0 1em 1em}.mw-parser-output .tpl-sidebar-pagedir-rtl,.mw-parser-output .tpl-sidebar.tpl-sidebar-floatleft{float:left;clear:left;margin:.5em 1em 1em 0}.mw-parser-output .tpl-sidebar.tpl-sidebar-floatnone{float:none;clear:both;margin:.5em 0 1em 1em}.mw-parser-output .tpl-sidebar>caption{padding-bottom:.2em;font-size:125%;line-height:1.2em;font-weight:bold}.mw-parser-output .tpl-sidebar>tbody>tr>th,.mw-parser-output .tpl-sidebar>tbody>tr>td{padding:0}.mw-parser-output .tpl-sidebar .tpl-sidebar-topimage>td{padding:.4em 0}.mw-parser-output .tpl-sidebar-imagecaption{padding-top:.2em;line-height:1.2em}.mw-parser-output .tpl-sidebar .tpl-sidebar-pretitle>td{padding-top:.4em;line-height:1.2em}.mw-parser-output .tpl-sidebar .tpl-sidebar-topimage+.tpl-sidebar-pretitle>td{padding-top:.2em}.mw-parser-output .tpl-sidebar .tpl-sidebar-title>th{padding:.2em .4em .2em;font-size:145%;line-height:1.2em}.mw-parser-output .tpl-sidebar .tpl-sidebar-pretitle+.tpl-sidebar-title>th{padding-top:0}.mw-parser-output .tpl-sidebar .tpl-sidebar-image>td{padding:.2em 0 .4em}.mw-parser-output .tpl-sidebar .tpl-sidebar-abovebelow>td{padding:.3em .4em;font-weight:bold}.mw-parser-output .tpl-sidebar .tpl-sidebar-heading>th{padding-top:.2em}.mw-parser-output .tpl-sidebar .tpl-sidebar-image~.tpl-sidebar-heading-first>th{padding-top:.4em}.mw-parser-output .tpl-sidebar .tpl-sidebar-content>td{padding-bottom:.2em}.mw-parser-output .tpl-sidebar :not(.tpl-sidebar-heading)+.tpl-sidebar-content-first>td{padding-top:.2em}.mw-parser-output .tpl-sidebar-navbar>td{font-size:115%}.mw-parser-output .tpl-sidebar-pagedir-ltr .tpl-sidebar-navbar>td{text-align:right}.mw-parser-output .tpl-sidebar-pagedir-rtl .tpl-sidebar-navbar>td{text-align:left}</style><table class="vertical-navbox tpl-sidebar tpl-sidebar-pagedir-ltr nowraplinks noprint" role="navigation" style="width:22em; border-spacing: 0.4em 0; width: 18em"><tbody><tr class="tpl-sidebar-heading tpl-sidebar-heading-first"> <th class="" style="text-align: left;"><span class="mw-valign-bottom" typeof="mw:File"><a href="/wiki/File:Gerrit_icon.svg" class="mw-file-description"><img src="//upload.wikimedia.org/wikipedia/commons/thumb/4/4d/Gerrit_icon.svg/20px-Gerrit_icon.svg.png" decoding="async" width="20" height="20" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/4/4d/Gerrit_icon.svg/30px-Gerrit_icon.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/4/4d/Gerrit_icon.svg/40px-Gerrit_icon.svg.png 2x" data-file-width="52" data-file-height="52"/></a></span> <big><a href="/wiki/Special:MyLanguage/Gerrit" title="Special:MyLanguage/Gerrit">Gerrit</a><span style="display:none"><a href="/wiki/Gerrit" title="Gerrit"> </a></span></big></th> </tr><tr class="tpl-sidebar-content tpl-sidebar-content-first"> <td class="" style="padding-left: 0.5em; text-align: left;"> <ul><li><a href="/wiki/Special:MyLanguage/Gerrit/How_Gerrit_works" title="Special:MyLanguage/Gerrit/How Gerrit works">How Gerrit works</a><span style="display:none"><a href="/wiki/Gerrit/How_Gerrit_works" title="Gerrit/How Gerrit works"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Gerrit/Tutorial" title="Special:MyLanguage/Gerrit/Tutorial">Gerrit tutorial</a><span style="display:none"><a href="/wiki/Gerrit/Tutorial" title="Gerrit/Tutorial"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Gerrit/Web_tutorial" title="Special:MyLanguage/Gerrit/Web tutorial">Web tutorial</a><span style="display:none"><a href="/wiki/Gerrit/Web_tutorial" title="Gerrit/Web tutorial"> </a></span></li> <li><b><a href="/wiki/Special:MyLanguage/Gerrit/Advanced_usage" title="Special:MyLanguage/Gerrit/Advanced usage">Advanced usage</a></b><span style="display:none"><a class="mw-selflink selflink"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Gerrit/Navigation" title="Special:MyLanguage/Gerrit/Navigation">Navigation</a><span style="display:none"><a href="/wiki/Gerrit/Navigation" title="Gerrit/Navigation"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Gerrit/Code_review" title="Special:MyLanguage/Gerrit/Code review">Code review guide</a><span style="display:none"><a href="/wiki/Gerrit/Code_review" title="Gerrit/Code review"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Gerrit/New_repositories" title="Special:MyLanguage/Gerrit/New repositories">New repositories</a><span style="display:none"><a href="/wiki/Gerrit/New_repositories" title="Gerrit/New repositories"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Gerrit/Troubleshooting" title="Special:MyLanguage/Gerrit/Troubleshooting">Troubleshooting</a><span style="display:none"><a href="/wiki/Gerrit/Troubleshooting" title="Gerrit/Troubleshooting"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Git_and_Gerrit_FAQ" title="Special:MyLanguage/Git and Gerrit FAQ">Common questions (FAQ)</a><span style="display:none"><a href="/wiki/Git_and_Gerrit_FAQ" title="Git and Gerrit FAQ"> </a></span></li> <li><a href="/wiki/Special:MyLanguage/Gerrit/Privilege_policy" title="Special:MyLanguage/Gerrit/Privilege policy">Privilege policy</a><span style="display:none"><a href="/wiki/Gerrit/Privilege_policy" title="Gerrit/Privilege policy"> </a></span></li></ul></td> </tr><tr class="tpl-sidebar-navbar"> <td style=""><style data-mw-deduplicate="TemplateStyles:r4692751">.mw-parser-output .navbar{display:inline;font-size:88%;font-weight:normal}.mw-parser-output .navbar ul{display:inline;white-space:nowrap}.mw-parser-output .navbar li{word-spacing:-0.125em}.mw-parser-output .navbox .navbar{display:block;font-size:100%}.mw-parser-output .navbox-title .navbar{float:left;text-align:left;margin-right:0.5em;width:6em}</style><span class="noprint plainlinks navbar" style=""><small><span style="white-space:nowrap;word-spacing:-.12em;"><a href="/wiki/Template:Git_and_Gerrit" title="Template:Git and Gerrit"><span style="" title="View this template">v</span></a><span style=""> <b>·</b> </span><a class="external text" href="https://www.mediawiki.org/wiki/Template_talk:Git_and_Gerrit"><span style="" title="Discuss this template">d</span></a><span style=""> <b>·</b> </span><a class="external text" href="https://www.mediawiki.org/w/index.php?title=Template:Git_and_Gerrit&action=edit"><span style="" title="Edit this template">e</span></a></span></small></span></td> </tr> </tbody></table> <figure typeof="mw:File/Thumb"><a href="/wiki/File:GitWorkflow.svg" class="mw-file-description"><img src="//upload.wikimedia.org/wikipedia/commons/thumb/0/0e/GitWorkflow.svg/300px-GitWorkflow.svg.png" decoding="async" width="300" height="230" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/0/0e/GitWorkflow.svg/450px-GitWorkflow.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/0/0e/GitWorkflow.svg/600px-GitWorkflow.svg.png 2x" data-file-width="541" data-file-height="414"/></a><figcaption>Visual representation of what MediaWiki's development workflow looks like</figcaption></figure> <p>The basic instructions to set up and operate with Git and Gerrit are described at the <a href="/wiki/Special:MyLanguage/Gerrit/Tutorial" title="Special:MyLanguage/Gerrit/Tutorial">Tutorial</a> (see also its <a href="/wiki/Special:MyLanguage/Gerrit/Getting_started" title="Special:MyLanguage/Gerrit/Getting started">shortest version</a>). </p> <meta property="mw:PageProp/toc"/> <div class="mw-heading mw-heading2 ext-discussiontools-init-section"><h2 id="Warning" data-mw-thread-id="h-Warning"><span data-mw-comment-start="" id="h-Warning"></span>Warning<span data-mw-comment-end="h-Warning"></span></h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=1" title="Edit section: Warning"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span><!--__DTELLIPSISBUTTON__{"threadItem":{"headingLevel":2,"name":"h-","type":"heading","level":0,"id":"h-Warning","replies":[]}}--></div> <p>This page mostly documents how to do things "the hard way" in Gerrit. The <code>git review</code> tool continues to improve, and now contains built-in mechanisms to push to a branch, upload a set of dependent patches, etc. You should probably review <code>man git review</code> before deciding that you need to proceed further here. </p> <div class="mw-heading mw-heading2 ext-discussiontools-init-section"><h2 id="Installation" data-mw-thread-id="h-Installation"><span data-mw-comment-start="" id="h-Installation"></span>Installation<span data-mw-comment-end="h-Installation"></span></h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=2" title="Edit section: Installation"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span><!--__DTELLIPSISBUTTON__{"threadItem":{"headingLevel":2,"name":"h-","type":"heading","level":0,"id":"h-Installation","replies":["h-Setup_SSH_shortcut_(optional)-Installation"]}}--></div> <div class="mw-heading mw-heading3"><h3 id="Setup_SSH_shortcut_(optional)" data-mw-thread-id="h-Setup_SSH_shortcut_(optional)-Installation"><span id="Setup_SSH_shortcut_.28optional.29"></span><span data-mw-comment-start="" id="h-Setup_SSH_shortcut_(optional)-Installation"></span>Setup SSH shortcut (optional)<span data-mw-comment-end="h-Setup_SSH_shortcut_(optional)-Installation"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=3" title="Edit section: Setup SSH shortcut (optional)"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>It's easier to access the repository if you don't have to specify the full <kbd><i>yourusername</i>@gerrit.wikimedia.org:29418</kbd> every time. You can edit your <code>~/.ssh/config</code> file and add </p> <pre>Host gerrit Hostname gerrit.wikimedia.org Port 29418 User yourusername </pre> <p>Then you can use "Gerrit" instead. </p> <dl><dd><i><code>git review -s</code> adds a <code>gerrit</code> remote to git which should make this step unnecessary.</i> <a href="/wiki/User:Cscott" title="User:Cscott">Cscott</a> (<a href="/wiki/User_talk:Cscott" title="User talk:Cscott">talk</a>)</dd></dl> <div class="mw-heading mw-heading2 ext-discussiontools-init-section"><!--__DTSUBSCRIBEBUTTONDESKTOP__{"headingLevel":2,"name":"h-S_Page_(WMF)-2013-05-17T02:28:00.000Z","type":"heading","level":0,"id":"h-Submitting_patches-2013-05-17T02:28:00.000Z","replies":["h-Setting_up_a_repository_for_git-remote-Submitting_patches","h-Howto_-_Merging_your_amend_back_into_your_branch-Submitting_patches","h-Submitting_a_change_to_a_branch_for_review_(\"backporting\")-Submitting_patches-2013-05-17T02:28:00.000Z","h-Acting_on_remote_branches-Submitting_patches","h-Committing_to_non_master-Submitting_patches","h-Partial_revert_of_previous_commit-Submitting_patches","h-Unlink_bogus_dependencies_(rebase_changes)-Submitting_patches","h-Create_a_dependency-Submitting_patches","h-Cross-project_dependencies-Submitting_patches","h-Splitting_a_commit_into_smaller_ones-Submitting_patches","h-Removing_your_local_branch_after_submitting_your_change_into_Gerrit-Submitting_patches","h-Merging_a_submodule_into_a_parent_project-Submitting_patches","h-Using_a_personal_sandbox_for_personal_branches-Submitting_patches","h-Troubleshooting-Submitting_patches"],"text":"Submitting patches","linkableTitle":"Submitting patches"}--><h2 id="Submitting_patches" data-mw-thread-id="h-Submitting_patches-2013-05-17T02:28:00.000Z"><span data-mw-comment-start="" id="h-Submitting_patches-2013-05-17T02:28:00.000Z"></span>Submitting patches<span data-mw-comment-end="h-Submitting_patches-2013-05-17T02:28:00.000Z"></span></h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=4" title="Edit section: Submitting patches"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span><!--__DTELLIPSISBUTTON__{"threadItem":{"headingLevel":2,"name":"h-S_Page_(WMF)-2013-05-17T02:28:00.000Z","type":"heading","level":0,"id":"h-Submitting_patches-2013-05-17T02:28:00.000Z","replies":["h-Setting_up_a_repository_for_git-remote-Submitting_patches","h-Howto_-_Merging_your_amend_back_into_your_branch-Submitting_patches","h-Submitting_a_change_to_a_branch_for_review_(\"backporting\")-Submitting_patches-2013-05-17T02:28:00.000Z","h-Acting_on_remote_branches-Submitting_patches","h-Committing_to_non_master-Submitting_patches","h-Partial_revert_of_previous_commit-Submitting_patches","h-Unlink_bogus_dependencies_(rebase_changes)-Submitting_patches","h-Create_a_dependency-Submitting_patches","h-Cross-project_dependencies-Submitting_patches","h-Splitting_a_commit_into_smaller_ones-Submitting_patches","h-Removing_your_local_branch_after_submitting_your_change_into_Gerrit-Submitting_patches","h-Merging_a_submodule_into_a_parent_project-Submitting_patches","h-Using_a_personal_sandbox_for_personal_branches-Submitting_patches","h-Troubleshooting-Submitting_patches"]}}--><div class="ext-discussiontools-init-section-bar"><div class="ext-discussiontools-init-section-metadata"><!--__DTLATESTCOMMENTTHREAD__{"id":"c-S_Page_(WMF)-2013-05-17T02:28:00.000Z-Submitting_a_change_to_a_branch_for_review_(\"backporting\")","timestamp":"2013-05-17T02:28:00.000Z"}__--><!--__DTCOMMENTCOUNT__1__--><!--__DTAUTHORCOUNT__1__--></div><div class="ext-discussiontools-init-section-actions"><!--__DTSUBSCRIBEBUTTONMOBILE__{"headingLevel":2,"name":"h-S_Page_(WMF)-2013-05-17T02:28:00.000Z","type":"heading","level":0,"id":"h-Submitting_patches-2013-05-17T02:28:00.000Z","replies":["h-Setting_up_a_repository_for_git-remote-Submitting_patches","h-Howto_-_Merging_your_amend_back_into_your_branch-Submitting_patches","h-Submitting_a_change_to_a_branch_for_review_(\"backporting\")-Submitting_patches-2013-05-17T02:28:00.000Z","h-Acting_on_remote_branches-Submitting_patches","h-Committing_to_non_master-Submitting_patches","h-Partial_revert_of_previous_commit-Submitting_patches","h-Unlink_bogus_dependencies_(rebase_changes)-Submitting_patches","h-Create_a_dependency-Submitting_patches","h-Cross-project_dependencies-Submitting_patches","h-Splitting_a_commit_into_smaller_ones-Submitting_patches","h-Removing_your_local_branch_after_submitting_your_change_into_Gerrit-Submitting_patches","h-Merging_a_submodule_into_a_parent_project-Submitting_patches","h-Using_a_personal_sandbox_for_personal_branches-Submitting_patches","h-Troubleshooting-Submitting_patches"],"text":"Submitting patches","linkableTitle":"Submitting patches"}--></div></div></div> <div class="mw-heading mw-heading3"><h3 id="Setting_up_a_repository_for_git-remote" data-mw-thread-id="h-Setting_up_a_repository_for_git-remote-Submitting_patches"><span data-mw-comment-start="" id="h-Setting_up_a_repository_for_git-remote-Submitting_patches"></span>Setting up a repository for git-remote<span data-mw-comment-end="h-Setting_up_a_repository_for_git-remote-Submitting_patches"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=5" title="Edit section: Setting up a repository for git-remote"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Most repositories should already have information for git-remote where your repository is and what the name of the master branch is. The information is stored in a <code>.gitreview</code> file in the root of the repository. If this file does not exist yet, you need to create and commit it. The format is the following: </p> <div class="mw-highlight mw-highlight-lang-ini mw-content-ltr" dir="ltr"><pre><span></span><span class="k">[gerrit]</span> <span class="na">host</span><span class="o">=</span><span class="s">gerrit.wikimedia.org</span> <span class="na">port</span><span class="o">=</span><span class="s">29418</span> <span class="na">project</span><span class="o">=</span><span class="s">operations/puppet.git</span> <span class="na">defaultbranch</span><span class="o">=</span><span class="s">production</span> </pre></div> <p>The <code>host</code> and <code>project</code> fields are mandatory. The other fields are optional: <code>port</code> defaults to 29418. <code>defaultbranch</code> defaults to <code>master</code>. </p> <div class="mw-heading mw-heading3"><h3 id="Howto_-_Merging_your_amend_back_into_your_branch" data-mw-thread-id="h-Howto_-_Merging_your_amend_back_into_your_branch-Submitting_patches"><span data-mw-comment-start="" id="h-Howto_-_Merging_your_amend_back_into_your_branch-Submitting_patches"></span>Howto - Merging your amend back into your branch<span data-mw-comment-end="h-Howto_-_Merging_your_amend_back_into_your_branch-Submitting_patches"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=6" title="Edit section: Howto - Merging your amend back into your branch"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p><i>This section is optional.</i> <i>It's offered as a convenience way to offer your a solution to a common problem.</i> <i>At this stage, your new changeset is already in Gerrit.</i> </p><p>After you have amended your change, you may want to merge it back into your local branch. </p><p>You can do this by going to the Gerrit change in question. </p><p>Here is an example: </p><p><a class="external free" href="https://gerrit.wikimedia.org/r/c/7669/4">https://gerrit.wikimedia.org/r/c/7669/4</a> </p><p>Go to the <i>Download</i> section and copy cherry pick. </p><p>We will select patch set 4. </p><p>Switch back to your branch. You will be in your review branch where you just made your change. </p> <style data-mw-deduplicate="TemplateStyles:r6651107">.mw-parser-output .note{background-position:left 7px top 50%;padding:0.5em 0.5em 0.5em 40px;margin:0.5em 0;overflow:hidden;background-color:#f8f9fa;color:#333;background-repeat:no-repeat;border:1px solid #ddd}.mw-parser-output .note-inline{display:inline-block;vertical-align:middle}.mw-parser-output .note-info{background-color:#eaf3ff;color:#333;background-image:url("https://upload.wikimedia.org/wikipedia/commons/e/ec/OOjs_UI_icon_information-progressive.svg");background-size:25px;border-color:#a3caff;padding-left:40px;min-height:25px}.mw-parser-output .note-reminder{background-color:#fff9ea;color:#333;background-image:url("https://upload.wikimedia.org/wikipedia/commons/a/a8/OOjs_UI_icon_lightbulb-yellow.svg");background-size:25px;border-color:#fc3;min-height:25px}.mw-parser-output .note-warn{background-color:#fff9ea;color:#333;background-image:url("https://upload.wikimedia.org/wikipedia/commons/3/3b/OOjs_UI_icon_alert-warning.svg");background-size:25px;border-color:#fc3;min-height:25px}.mw-parser-output .note-error{background-color:#fee7e6;color:#333;background-image:url("https://upload.wikimedia.org/wikipedia/commons/b/bf/OOjs_UI_icon_notice-destructive.svg");background-size:25px;border-color:#c33;min-height:25px}@media screen{html.skin-theme-clientpref-night .mw-parser-output .note{background-color:transparent;color:inherit}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .note{background-color:transparent;color:inherit}}</style><div role="note" class="note note-info">Use the branch relevant to your change number.</div> <div class="mw-highlight mw-highlight-lang-bash mw-content-ltr" dir="ltr"><pre><span></span>git<span class="w"> </span>checkout<span class="w"> </span>mingle-fr-2012-59 </pre></div> <p>Paste in the cherry pick and merge any conflicts. </p> <div class="mw-highlight mw-highlight-lang-bash mw-content-ltr" dir="ltr"><pre><span></span>git<span class="w"> </span>fetch<span class="w"> </span>ssh://<USERNAME>@gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface<span class="w"> </span>refs/changes/69/7669/4<span class="w"> </span><span class="o">&&</span><span class="w"> </span>git<span class="w"> </span>cherry-pick<span class="w"> </span>FETCH_HEAD </pre></div> <p>Perform a git add on the modified files. </p> <div class="mw-highlight mw-highlight-lang-bash mw-content-ltr" dir="ltr"><pre><span></span>git<span class="w"> </span>add<span class="w"> </span>payflowpro_gateway/payflowpro.adapter.php </pre></div> <p>Do not forget to check your status and run a diff. </p> <div class="mw-highlight mw-highlight-lang-bash mw-content-ltr" dir="ltr"><pre><span></span>git<span class="w"> </span>diff </pre></div> <p>You should see there are no differences: </p> <div class="mw-highlight mw-highlight-lang-diff mw-content-ltr" dir="ltr"><pre><span></span><span class="gh">diff --cc payflowpro_gateway/payflowpro.adapter.php</span> <span class="gh">index d7e510a,738c9df..0000000</span> <span class="gd">--- a/payflowpro_gateway/payflowpro.adapter.php</span> <span class="gi">+++ b/payflowpro_gateway/payflowpro.adapter.php</span> </pre></div> <p>Then commit the changes: </p> <div class="mw-highlight mw-highlight-lang-bash mw-content-ltr" dir="ltr"><pre><span></span>git<span class="w"> </span>commit<span class="w"> </span>-m<span class="w"> </span><span class="s1">'Merging patch set 4.'</span> <span class="o">[</span>mingle-fr-2012-59<span class="w"> </span>4e82e5a<span class="o">]</span><span class="w"> </span>Merging<span class="w"> </span>patch<span class="w"> </span><span class="nb">set</span><span class="w"> </span><span class="m">4</span>. <span class="w"> </span><span class="m">1</span><span class="w"> </span>files<span class="w"> </span>changed,<span class="w"> </span><span class="m">3</span><span class="w"> </span>insertions<span class="o">(</span>+<span class="o">)</span>,<span class="w"> </span><span class="m">3</span><span class="w"> </span>deletions<span class="o">(</span>-<span class="o">)</span> </pre></div> <div class="mw-heading mw-heading3"><h3 id="Submitting_a_change_to_a_branch_for_review_("backporting")" data-mw-thread-id="h-Submitting_a_change_to_a_branch_for_review_("backporting")-Submitting_patches-2013-05-17T02:28:00.000Z"><span id="Submitting_a_change_to_a_branch_for_review_.28.22backporting.22.29"></span><span data-mw-comment-start="" id="h-Submitting_a_change_to_a_branch_for_review_("backporting")-Submitting_patches-2013-05-17T02:28:00.000Z"></span>Submitting a change to a branch for review ("backporting")<span data-mw-comment-end="h-Submitting_a_change_to_a_branch_for_review_("backporting")-Submitting_patches-2013-05-17T02:28:00.000Z"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=7" title="Edit section: Submitting a change to a branch for review ("backporting")"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <dl><dd><i><span data-mw-comment-start="" id="c-S_Page_(WMF)-2013-05-17T02:28:00.000Z-Submitting_a_change_to_a_branch_for_review_("backporting")"></span>See also <a href="/wiki/Special:MyLanguage/Backporting_fixes" title="Special:MyLanguage/Backporting fixes">Backporting fixes</a><span style="display:none"><a href="/wiki/Backporting_fixes" title="Backporting fixes"> </a></span>, which discusses backporting changes to MediaWiki core (coordinate with the <a href="/wiki/Wikimedia_Release_Engineering_Team" title="Wikimedia Release Engineering Team">WMF Release Engineering Team</a>, handling in <a href="/wiki/Special:MyLanguage/Phabricator" title="Special:MyLanguage/Phabricator">Phabricator</a><span style="display:none"><a href="/wiki/Phabricator" title="Phabricator"> </a></span>, etc.)</i></dd></dl> <p>In this example, we will backport <a href="https://gerrit.wikimedia.org/r/q/Ib27792b661666ac5f704eeaaadcdd9668dd81b56" class="extiw" title="gerrit:q/Ib27792b661666ac5f704eeaaadcdd9668dd81b56">Gerrit #Ib27792</a> from <code>master</code> to <code>REL1_20</code>. The basic idea is to use <code>git cherry-pick</code> to apply the changes from the commit to master to a different branch. (Note that this can also be done via the Gerrit web interface, with the 'Cherry Pick' button.) </p><p>Before you start, look up the git commit hash of the commit that was merged into master. This can be found on the Gerrit change page. Scroll down to the last Patch Set, and the git commit hash is between "Patch Set <i>NN</i>" and "(gitweb)" (not to be confused with the <i>Gerrit Change id</i> which starts with a capital 'I'). Make sure that this commit was indeed merged into the master branch. If it wasn't then wait until it has been reviewed and merged in master — the commit may still be amended and we don't want to merge an old version. </p> <div class="mw-highlight mw-highlight-lang-shell-session mw-content-ltr" dir="ltr"><pre><span></span><span class="gp">$ </span>git<span class="w"> </span>fetch<span class="w"> </span>origin <span class="gp"># </span>The<span class="w"> </span>git<span class="w"> </span>commit<span class="w"> </span><span class="nb">hash</span><span class="w"> </span>of<span class="w"> </span>the<span class="w"> </span>change<span class="w"> </span><span class="k">in</span><span class="w"> </span>master. <span class="gp">$ </span>git<span class="w"> </span>show<span class="w"> </span>d4f2c0e8f76a7634fce1631669f4ce037965d8b5 <span class="gp">$ </span>git<span class="w"> </span>checkout<span class="w"> </span>origin/REL1_20 <span class="gp">$ </span>git<span class="w"> </span>reset<span class="w"> </span>--hard<span class="w"> </span>origin/REL1_20<span class="w"> </span><span class="c1"># Ensure latest version, undo any local dependencies</span> <span class="gp">$ </span>git<span class="w"> </span>cherry-pick<span class="w"> </span>d4f2c0e8f76a7634fce1631669f4ce037965d8b5 <span class="gp"># </span>Do<span class="w"> </span>not<span class="w"> </span>change<span class="w"> </span>the<span class="w"> </span>commit<span class="w"> </span>message.<span class="w"> </span>In<span class="w"> </span>particular<span class="w"> </span>leave<span class="w"> </span>the <span class="gp"># </span><span class="s2">"Change-Id"</span><span class="w"> </span>intact<span class="w"> </span>at<span class="w"> </span>the<span class="w"> </span>bottom<span class="w"> </span>of<span class="w"> </span>the<span class="w"> </span>message,<span class="w"> </span>since<span class="w"> </span>this<span class="w"> </span>is <span class="gp"># </span>what<span class="w"> </span>Gerrit<span class="w"> </span>uses<span class="w"> </span>to<span class="w"> </span>relate<span class="w"> </span>the<span class="w"> </span>master<span class="w"> </span>change<span class="w"> </span>and<span class="w"> </span>the<span class="w"> </span>branch<span class="w"> </span>merge. <span class="gp"># </span>If<span class="w"> </span>the<span class="w"> </span>merge<span class="w"> </span>causes<span class="w"> </span>conflicts,<span class="w"> </span>you<span class="w"> </span>should<span class="w"> </span>fix<span class="w"> </span>them<span class="w"> </span>manually, <span class="gp"># </span>use<span class="w"> </span>git<span class="w"> </span>add<span class="w"> </span><files><span class="w"> </span>and<span class="w"> </span>run<span class="w"> </span>git<span class="w"> </span>commit.<span class="w"> </span>Move<span class="w"> </span>the<span class="w"> </span><span class="s2">"Conflicts"</span><span class="w"> </span>section <span class="gp"># </span>of<span class="w"> </span>the<span class="w"> </span>commit<span class="w"> </span>message<span class="w"> </span>before<span class="w"> </span><span class="s2">"Change-Id"</span>,<span class="w"> </span>so<span class="w"> </span><span class="s2">"Change-Id"</span><span class="w"> </span>remains<span class="w"> </span>at <span class="gp"># </span>the<span class="w"> </span>bottom<span class="w"> </span>of<span class="w"> </span>the<span class="w"> </span>message,<span class="w"> </span>otherwise<span class="w"> </span>the<span class="w"> </span>push<span class="w"> </span>will<span class="w"> </span>be<span class="w"> </span>rejected. <span class="gp"># </span>Verify<span class="w"> </span><span class="nb">history</span><span class="w"> </span>looks<span class="w"> </span>as<span class="w"> </span>expected <span class="gp">$ </span>git<span class="w"> </span>log<span class="w"> </span>--graph<span class="w"> </span>--decorate<span class="w"> </span>--oneline<span class="w"> </span>-n5 <span class="gp"># </span>View<span class="w"> </span>the<span class="w"> </span>original<span class="w"> </span>change<span class="w"> </span><span class="k">in</span><span class="w"> </span>Gerrit<span class="w"> </span>and<span class="w"> </span>look<span class="w"> </span>up<span class="w"> </span>the<span class="w"> </span>topic-name, <span class="gp"># </span><span class="k">then</span><span class="w"> </span>use<span class="w"> </span>it<span class="w"> </span>below<span class="w"> </span><span class="k">in</span><span class="w"> </span>place<span class="w"> </span>of<span class="w"> </span><span class="s2">"topic-name"</span>,<span class="w"> </span>e.g.<span class="w"> </span><span class="s2">"refs/for/REL1_20/bug/36151"</span> <span class="gp"># </span>or<span class="w"> </span><span class="s2">"refs/for/wmf/1.21wmf1/my-topic-name"</span> <span class="gp">$ </span>git<span class="w"> </span>push<span class="w"> </span>origin<span class="w"> </span>HEAD:refs/for/REL1_20/bug/36151 <span class="go">remote: </span> <span class="go">remote: New Changes:</span> <span class="go">remote: https://gerrit.wikimedia.org/r/25756</span> <span class="go">remote: </span> <span class="go"> * [new branch] HEAD -> refs/for/REL1_20/bug/36151</span> </pre></div> <dl><dd><i>Is there any need to use complicated <code>git push</code> instead of <code>git review</code> here?</i> -- <a href="/wiki/User:S_Page_(WMF)" class="mw-redirect" title="User:S Page (WMF)">S Page (WMF)</a> (<a href="/wiki/User_talk:S_Page_(WMF)" class="mw-redirect" title="User talk:S Page (WMF)">talk</a>) <a href="https://www.mediawiki.org/wiki/Gerrit/Advanced_usage#c-S_Page_(WMF)-2013-05-17T02:28:00.000Z-Submitting_a_change_to_a_branch_for_review_("backporting")" class="ext-discussiontools-init-timestamplink">02:28, 17 May 2013 (UTC)</a><span class="ext-discussiontools-init-replylink-buttons" data-mw-thread-id="c-S_Page_(WMF)-2013-05-17T02:28:00.000Z-Submitting_a_change_to_a_branch_for_review_("backporting")"><span class="ext-discussiontools-init-replylink-bracket">[</span><a class="ext-discussiontools-init-replylink-reply" role="button" tabindex="0" href="">reply</a><span class="ext-discussiontools-init-replylink-bracket">]</span><!--__DTELLIPSISBUTTON__{"threadItem":{"timestamp":"2013-05-17T02:28:00.000Z","author":"S Page (WMF)","type":"comment","level":2,"id":"c-S_Page_(WMF)-2013-05-17T02:28:00.000Z-Submitting_a_change_to_a_branch_for_review_(\"backporting\")","replies":[]}}--></span><span data-mw-comment-end="c-S_Page_(WMF)-2013-05-17T02:28:00.000Z-Submitting_a_change_to_a_branch_for_review_("backporting")"></span> <dl><dd>The only reason would be so that you can give it a new topic. So alternatively, after the <code>git log</code> check, look up the topic name first (or think of a new topic) and do <code>git checkout -b random-new-topic-name</code> then followed by regular <code>git review -R</code> (instead of git push); as of git-review version 1.23, it will reuse the original topic.</dd> <dd><code>git review -R remote-branch-name</code> works too if you want to push to a remote branch from a review branch.</dd></dl></dd></dl> <p>As a result: </p> <ul><li><a class="external free" href="https://gerrit.wikimedia.org/r/25756">https://gerrit.wikimedia.org/r/25756</a> is created for review.</li> <li><a href="https://gerrit.wikimedia.org/r/q/Ib27792b661666ac5f704eeaaadcdd9668dd81b56" class="extiw" title="gerrit:q/Ib27792b661666ac5f704eeaaadcdd9668dd81b56">Gerrit #Ib27792</a> shows both the original and the merge changes</li></ul> <div class="mw-heading mw-heading3"><h3 id="Acting_on_remote_branches" data-mw-thread-id="h-Acting_on_remote_branches-Submitting_patches"><span data-mw-comment-start="" id="h-Acting_on_remote_branches-Submitting_patches"></span>Acting on remote branches<span data-mw-comment-end="h-Acting_on_remote_branches-Submitting_patches"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=8" title="Edit section: Acting on remote branches"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>By default, your local clone will only have a local master branch set up to track the remote master branch. Tracking means that whenever you fetch objects from the remote repository, git status or git branch will be able to tell you how up-to-date is your local branch, which is very useful. So, whenever you want to regularly act on a remote branch (lets says REMOTE_BRANCH, you want to setup a one locally (REMOTE_BRANCH too to easily remember about it) that track it (with -t). </p> <div class="mw-highlight mw-highlight-lang-bash mw-content-ltr" dir="ltr"><pre><span></span>git<span class="w"> </span>branch<span class="w"> </span>-vv </pre></div> <p>will give the full details: </p> <div class="mw-highlight mw-highlight-lang-shell-session mw-content-ltr" dir="ltr"><pre><span></span><span class="gp">$ </span>git<span class="w"> </span>clone<span class="w"> </span>... <span class="gp">$ </span>git<span class="w"> </span>checkout<span class="w"> </span>-b<span class="w"> </span>REL1_19<span class="w"> </span>-t<span class="w"> </span>gerrit/REL1_19 <span class="gp">$ </span>git<span class="w"> </span>branch<span class="w"> </span>-vv <span class="go"> REL1_19 3b2bfd3 [gerrit/REL1_19: ahead 1] .gitreview for REL1_19 branch</span> <span class="go">* master 13169c8 [gerrit/master: behind 1] * (bug 34212) ApiBlock/ApiUnblock a[...]</span> <span class="gp">$</span> </pre></div> <div class="mw-heading mw-heading4"><h4 id="Pushing_having_used_automatic_setup" data-mw-thread-id="h-Pushing_having_used_automatic_setup-Acting_on_remote_branches"><span data-mw-comment-start="" id="h-Pushing_having_used_automatic_setup-Acting_on_remote_branches"></span>Pushing having used automatic setup<span data-mw-comment-end="h-Pushing_having_used_automatic_setup-Acting_on_remote_branches"></span></h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=9" title="Edit section: Pushing having used automatic setup"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>git-review accepts, as an optional argument, the branch name to interact with. When that argument is not specified, it falls back to look for the <code>defaultbranch</code> parameter in a <code>.gitreview</code> file at the root of the repository. </p><p>Every branch should have a .gitreview having a correct defaultbranch value. For <code>mediawiki/core.git</code>, else people will have to use something like: <code class="mw-highlight mw-highlight-lang-bash mw-content-ltr" dir="ltr">git-review<span class="w"> </span>BRANCH_NAME</code>. </p> <table class="warning-message" style="background-color: var( --background-color-error-subtle, #ffe9e5 ); color: var( --color-base, #202122 ); border: 1px var( --border-color-error, #9f3526 ) solid; box-sizing: border-box; margin: 0.5em 0; padding: 0.5em;"><tbody><tr><td style="white-space: nowrap; vertical-align: top;"><span style="position: relative; top: -2px;"><span typeof="mw:File"><span><img alt="Warning" src="//upload.wikimedia.org/wikipedia/commons/thumb/b/bf/OOjs_UI_icon_notice-destructive.svg/18px-OOjs_UI_icon_notice-destructive.svg.png" decoding="async" width="18" height="18" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/b/bf/OOjs_UI_icon_notice-destructive.svg/27px-OOjs_UI_icon_notice-destructive.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/b/bf/OOjs_UI_icon_notice-destructive.svg/36px-OOjs_UI_icon_notice-destructive.svg.png 2x" data-file-width="20" data-file-height="20"/></span></span></span> <b>Warning:</b> </td><td style="padding-left: 0.5em vertical-align: top;">By default <code class="mw-highlight mw-highlight-lang-bash mw-content-ltr" dir="ltr">git-review</code> uses a branch named 'master' which might not be what you want. Check the .gitreview file to be sure.</td></tr></tbody></table> <div class="mw-heading mw-heading4"><h4 id="Pushing_having_used_manual_(Windows)_setup" data-mw-thread-id="h-Pushing_having_used_manual_(Windows)_setup-Acting_on_remote_branches"><span id="Pushing_having_used_manual_.28Windows.29_setup"></span><span data-mw-comment-start="" id="h-Pushing_having_used_manual_(Windows)_setup-Acting_on_remote_branches"></span>Pushing having used manual (Windows) setup<span data-mw-comment-end="h-Pushing_having_used_manual_(Windows)_setup-Acting_on_remote_branches"></span></h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=10" title="Edit section: Pushing having used manual (Windows) setup"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <style data-mw-deduplicate="TemplateStyles:r6353907">.mw-parser-output .hatnote{font-style:italic;padding-bottom:0.4em;margin-bottom:0.4em;border-bottom:1px solid #ccc}.mw-parser-output .hatnote.no-border{border-bottom:none}</style><div role="note" class="hatnote mw-tpl-seealso">See also: <a href="/wiki/Gerrit/Alternatives_to_git-review" title="Gerrit/Alternatives to git-review">Gerrit/Alternatives to git-review</a></div> <p>To change where you push to for review having performed a manual setup, run <code>git config alias.push-for-review "push gerrit HEAD:refs/for/BRANCH_NAME"</code> to create the local alias, then use <code>git push-for-review</code> as per usual. </p> <div class="mw-heading mw-heading3"><h3 id="Committing_to_non_master" data-mw-thread-id="h-Committing_to_non_master-Submitting_patches"><span data-mw-comment-start="" id="h-Committing_to_non_master-Submitting_patches"></span>Committing to non master<span data-mw-comment-end="h-Committing_to_non_master-Submitting_patches"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=11" title="Edit section: Committing to non master"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>To make a change to the 1.17 branch, create a branch and tag, and push both: </p> <div class="mw-highlight mw-highlight-lang-bash mw-content-ltr" dir="ltr"><pre><span></span>git<span class="w"> </span>checkout<span class="w"> </span>-b<span class="w"> </span>REL1_17<span class="w"> </span>origin/REL1_17 <make<span class="w"> </span>code<span class="w"> </span>changes> git<span class="w"> </span>add<span class="w"> </span><files-changed> git<span class="w"> </span>commit git<span class="w"> </span>push<span class="w"> </span>gerrit<span class="w"> </span>REL1_17 git<span class="w"> </span>tag<span class="w"> </span><span class="m">1</span>.17.3 git<span class="w"> </span>push<span class="w"> </span>--tags </pre></div> <div class="mw-heading mw-heading3"><h3 id="Partial_revert_of_previous_commit" data-mw-thread-id="h-Partial_revert_of_previous_commit-Submitting_patches"><span data-mw-comment-start="" id="h-Partial_revert_of_previous_commit-Submitting_patches"></span>Partial revert of previous commit<span data-mw-comment-end="h-Partial_revert_of_previous_commit-Submitting_patches"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=12" title="Edit section: Partial revert of previous commit"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <div class="mw-highlight mw-highlight-lang-bash mw-content-ltr" dir="ltr"><pre><span></span>git<span class="w"> </span>show<span class="w"> </span><commit><span class="w"> </span>--<span class="w"> </span><path><span class="w"> </span><span class="p">|</span><span class="w"> </span>git<span class="w"> </span>apply<span class="w"> </span>-R </pre></div> <p><commit> Can be found in gerrit patch view in small letters next to text <i>Patch Set N</i>. Then push for review normally. </p> <div class="mw-heading mw-heading3"><h3 id="Unlink_bogus_dependencies_(rebase_changes)" data-mw-thread-id="h-Unlink_bogus_dependencies_(rebase_changes)-Submitting_patches"><span id="Unlink_bogus_dependencies_.28rebase_changes.29"></span><span data-mw-comment-start="" id="h-Unlink_bogus_dependencies_(rebase_changes)-Submitting_patches"></span>Unlink bogus dependencies (rebase changes)<span data-mw-comment-end="h-Unlink_bogus_dependencies_(rebase_changes)-Submitting_patches"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=13" title="Edit section: Unlink bogus dependencies (rebase changes)"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Example for <a href="https://gerrit.wikimedia.org/r/5154" class="extiw" title="gerrit:5154">gerrit:5154</a> </p> <pre>git fetch --all # To make sure we have latest changes git review -d Ie6e3c9be git rebase -i gerrit/master # Delete the commits you want to get rid of git commit --amend # Add a note git review -f # -f deletes the branch after submit </pre> <div class="mw-heading mw-heading3"><h3 id="Create_a_dependency" data-mw-thread-id="h-Create_a_dependency-Submitting_patches"><span data-mw-comment-start="" id="h-Create_a_dependency-Submitting_patches"></span>Create a dependency<span data-mw-comment-end="h-Create_a_dependency-Submitting_patches"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=14" title="Edit section: Create a dependency"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>If you are about to create a patch that depends on another (unmerged) patch, or if you already submitted a patch but need to fix the dependency (i.e. currently it is based on master and would break if merged without the dependency, or maybe you squashed your change on top of the dependency), then this is the section you are looking for. If you want to fix the patch to have the right dependency rather than create a new patch with a dependency, then make sure your working copy is clean (no uncommitted changes). </p> <pre>git fetch --all # Make sure we have latest info from the repository git review -d 1234 # Gerrit change number of the change you want as dependency ("parent") </pre> <p>Now we need to make sure the patch has the correct git-parent. Depending on whether you are creating a new patch or fixing an existing patch, there are two different ways to do this. If you are starting fresh: </p> <pre>git checkout -b bug/1234 # Creates a new branch, with the current branch (the dependency) as parent # Edit files: make your changes git add someFile.php some/other/file.js git commit # Commit your patch git log -n5 --decorate --pretty=oneline # Verify that the last 5 entries of the log now start with: # * (HEAD, bug/1234) your change # * (review/john/700) the dependency # * (gerrit/master) git push gerrit HEAD:refs/for/master # or git review </pre> <p>If you need to amend your patch to have the correct dependency: </p> <pre>git branch # Take note of the review/* branch that was created for this, it has an "*" in front of it git checkout bug/1234 # Check out the local topic branch of your change git rebase review/john/7000 # The branch name of the gerrit change we checked out earlier # Resolve conflicts if needed, # - use "git status" to see the files that need resolution # - after fixing it in your editor, "git add filename" for each of the fixed files git rebase --continue git log -n5 --decorate --pretty=oneline # Verify that the last 5 entries of the log now start with: # * (HEAD, bug/1234) your change # * (review/john/700) the dependency # * (gerrit/master) git push gerrit HEAD:refs/for/master # or git review </pre><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r6651107"><div role="note" class="note note-reminder">If you wish to set a topic, use: <pre>git push gerrit HEAD:refs/for/master%topic=myawesometopic </pre> <p>or </p> <pre>git review -t myawesometopic </pre></div> <div class="mw-heading mw-heading3"><h3 id="Cross-project_dependencies" data-mw-thread-id="h-Cross-project_dependencies-Submitting_patches"><span data-mw-comment-start="" id="h-Cross-project_dependencies-Submitting_patches"></span>Cross-project dependencies<span data-mw-comment-end="h-Cross-project_dependencies-Submitting_patches"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=15" title="Edit section: Cross-project dependencies"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>You can also use cross-project dependencies (e.g. an extension that requires a change in core before it can be merged). You can accomplish this by adding e.g. <code>Depends-On: I75b266da99e7dcb948f10d182e7f00bb3debfac6</code> in the footer of a commit message. Use the full Change-ID (‘I’ + 40 characters). See <a rel="nofollow" class="external free" href="https://docs.openstack.org/infra/zuul/feature/zuulv3/user/gating.html#cross-project-dependencies">https://docs.openstack.org/infra/zuul/feature/zuulv3/user/gating.html#cross-project-dependencies</a> for more details. </p><p>Examples: <a href="https://gerrit.wikimedia.org/r/539718" class="extiw" title="gerrit:539718">Gerrit:539718</a>, <a href="https://gerrit.wikimedia.org/r/534888" class="extiw" title="gerrit:534888">Gerrit:534888</a> </p> <div class="mw-heading mw-heading3"><h3 id="Splitting_a_commit_into_smaller_ones" data-mw-thread-id="h-Splitting_a_commit_into_smaller_ones-Submitting_patches"><span data-mw-comment-start="" id="h-Splitting_a_commit_into_smaller_ones-Submitting_patches"></span>Splitting a commit into smaller ones<span data-mw-comment-end="h-Splitting_a_commit_into_smaller_ones-Submitting_patches"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=16" title="Edit section: Splitting a commit into smaller ones"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Explained in detail at <a href="/wiki/Special:MyLanguage/Gerrit/split_a_submitted_change" title="Special:MyLanguage/Gerrit/split a submitted change">Gerrit/split a submitted change</a><span style="display:none"><a href="/wiki/Gerrit/split_a_submitted_change" title="Gerrit/split a submitted change"> </a></span>. </p> <div class="mw-heading mw-heading3"><h3 id="Removing_your_local_branch_after_submitting_your_change_into_Gerrit" data-mw-thread-id="h-Removing_your_local_branch_after_submitting_your_change_into_Gerrit-Submitting_patches"><span data-mw-comment-start="" id="h-Removing_your_local_branch_after_submitting_your_change_into_Gerrit-Submitting_patches"></span>Removing your local branch after submitting your change into Gerrit<span data-mw-comment-end="h-Removing_your_local_branch_after_submitting_your_change_into_Gerrit-Submitting_patches"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=17" title="Edit section: Removing your local branch after submitting your change into Gerrit"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <div class="mw-highlight mw-highlight-lang-shell-session mw-content-ltr" dir="ltr"><pre><span></span><span class="gp">you@yourmachine:~/puppet (production)$ </span>git<span class="w"> </span>checkout<span class="w"> </span>-b<span class="w"> </span>mycoolfeature <span class="gp">you@yourmachine:~/puppet (mycoolfeature)$ </span>vi<span class="w"> </span>foobar <span class="gp">you@yourmachine:~/puppet (mycoolfeature)$ </span>git<span class="w"> </span>commit<span class="w"> </span>-a<span class="w"> </span>-m<span class="w"> </span><span class="s2">"Committing my cool feature"</span> <span class="gp">you@yourmachine:~/puppet (mycoolfeature)$ </span>git<span class="w"> </span>review<span class="w"> </span>-f <span class="gp">you@yourmachine:~/puppet (production)$</span> </pre></div> <p>If the <code>-f</code> flag is passed to git-review, it will try to submit the change, and if it succeeds it will switch back to the master branch (production in this case) and delete the feature branch. </p> <div class="mw-heading mw-heading3"><h3 id="Merging_a_submodule_into_a_parent_project" data-mw-thread-id="h-Merging_a_submodule_into_a_parent_project-Submitting_patches"><span data-mw-comment-start="" id="h-Merging_a_submodule_into_a_parent_project-Submitting_patches"></span>Merging a submodule into a parent project<span data-mw-comment-end="h-Merging_a_submodule_into_a_parent_project-Submitting_patches"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=18" title="Edit section: Merging a submodule into a parent project"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>See <a href="/wiki/Special:MyLanguage/Gerrit/merge_submodule" title="Special:MyLanguage/Gerrit/merge submodule">Gerrit/merge submodule</a>. </p> <div class="mw-heading mw-heading3"><h3 id="Using_a_personal_sandbox_for_personal_branches" data-mw-thread-id="h-Using_a_personal_sandbox_for_personal_branches-Submitting_patches"><span data-mw-comment-start="" id="h-Using_a_personal_sandbox_for_personal_branches-Submitting_patches"></span>Using a personal sandbox for personal branches<span data-mw-comment-end="h-Using_a_personal_sandbox_for_personal_branches-Submitting_patches"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=19" title="Edit section: Using a personal sandbox for personal branches"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Gerrit allows the creation of "personal sandboxes" where users can stash code that they are working on in a personal branch that doesn't require admin intervention for pushes. See <a href="/wiki/Special:MyLanguage/Gerrit/personal_sandbox" title="Special:MyLanguage/Gerrit/personal sandbox">Gerrit/personal sandbox</a>. </p> <div class="mw-heading mw-heading3"><h3 id="Troubleshooting" data-mw-thread-id="h-Troubleshooting-Submitting_patches"><span data-mw-comment-start="" id="h-Troubleshooting-Submitting_patches"></span>Troubleshooting<span data-mw-comment-end="h-Troubleshooting-Submitting_patches"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=20" title="Edit section: Troubleshooting"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>For problems and how to solve them, see <a href="/wiki/Special:MyLanguage/Gerrit/Troubleshooting" title="Special:MyLanguage/Gerrit/Troubleshooting">Gerrit/Troubleshooting</a>. </p> <div class="mw-heading mw-heading2 ext-discussiontools-init-section"><h2 id="Working_on_an_existing_change_set" data-mw-thread-id="h-Working_on_an_existing_change_set"><span data-mw-comment-start="" id="h-Working_on_an_existing_change_set"></span>Working on an existing change set<span data-mw-comment-end="h-Working_on_an_existing_change_set"></span></h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=21" title="Edit section: Working on an existing change set"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span><!--__DTELLIPSISBUTTON__{"threadItem":{"headingLevel":2,"name":"h-","type":"heading","level":0,"id":"h-Working_on_an_existing_change_set","replies":["h-Manually_rebase_(on_a_branch)-Working_on_an_existing_change_set","h-Manually_rebase_(on_parent)-Working_on_an_existing_change_set"]}}--></div> <p>Sometimes you want to work on a change set started by some else and then upload your changes as a new patch set. </p> <div class="mw-highlight mw-highlight-lang-shell-session mw-content-ltr" dir="ltr"><pre><span></span><span class="gp"># </span>Note<span class="w"> </span><span class="k">in</span><span class="w"> </span>the<span class="w"> </span>gerrit<span class="w"> </span>URL<span class="w"> </span>the<span class="w"> </span>number<span class="w"> </span>reference<span class="w"> </span>to<span class="w"> </span>the<span class="w"> </span>change<span class="w"> </span>set,<span class="w"> </span> <span class="gp"># </span>e.g.,<span class="w"> </span>https://gerrit.wikimedia.org/r/#/c/70112/,<span class="w"> </span>thus<span class="w"> </span><span class="m">70112</span> <span class="gp"># </span>In<span class="w"> </span>your<span class="w"> </span><span class="nb">local</span><span class="w"> </span>copy<span class="w"> </span>of<span class="w"> </span>the<span class="w"> </span>master<span class="w"> </span>branch,<span class="w"> </span>pull<span class="w"> </span>down<span class="w"> </span>the<span class="w"> </span>change<span class="w"> </span><span class="nb">set</span><span class="w"> </span> <span class="gp"># </span>and<span class="w"> </span>switch<span class="w"> </span>to<span class="w"> </span>that<span class="w"> </span>branch<span class="w"> </span>with<span class="w"> </span>the<span class="w"> </span>following<span class="w"> </span>command. <span class="go">git review -d 70112</span> <span class="gp"># </span>Make<span class="w"> </span>any<span class="w"> </span>necessary<span class="w"> </span>changes<span class="w"> </span>and<span class="w"> </span>commit<span class="w"> </span>them<span class="w"> </span>as<span class="w"> </span>an<span class="w"> </span>amendment,<span class="w"> </span> <span class="gp"># </span>adding<span class="w"> </span>appropriate<span class="w"> </span>comments<span class="w"> </span>to<span class="w"> </span>the<span class="w"> </span>commit<span class="w"> </span>message. <span class="go">git commit --all --amend</span> <span class="gp"># </span>Push<span class="w"> </span>the<span class="w"> </span>patch<span class="w"> </span><span class="nb">set</span><span class="w"> </span>up<span class="w"> </span>to<span class="w"> </span>gerrit<span class="w"> </span>as<span class="w"> </span>usual. <span class="go">git review -R</span> <span class="gp"># </span>Other<span class="w"> </span>developers<span class="w"> </span>can<span class="w"> </span><span class="k">then</span><span class="w"> </span>update<span class="w"> </span>their<span class="w"> </span><span class="nb">local</span><span class="w"> </span>copy<span class="w"> </span>of<span class="w"> </span>the<span class="w"> </span>change<span class="w"> </span><span class="nb">set</span><span class="w"> </span> <span class="gp"># </span>with<span class="w"> </span>the<span class="w"> </span>following<span class="w"> </span>command. <span class="go">git review -d 70112</span> </pre></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r6651107"><div role="note" class="note note-info"><b>DO NOT</b> use the <code>-m</code> flag to specify a commit summary: that will override the previous summary and regenerate the Change-Id. Instead, use your text editor to change the commit summary if needed, and keep the Change-Id line intact. (See: <a href="/wiki/Special:MyLanguage/Gerrit/Tutorial#Amending_a_change" title="Special:MyLanguage/Gerrit/Tutorial">Amending_a_change</a>)</div> <div class="mw-heading mw-heading3"><h3 id="Manually_rebase_(on_a_branch)" data-mw-thread-id="h-Manually_rebase_(on_a_branch)-Working_on_an_existing_change_set"><span id="Manually_rebase_.28on_a_branch.29"></span><span data-mw-comment-start="" id="h-Manually_rebase_(on_a_branch)-Working_on_an_existing_change_set"></span>Manually rebase (on a branch)<span data-mw-comment-end="h-Manually_rebase_(on_a_branch)-Working_on_an_existing_change_set"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=22" title="Edit section: Manually rebase (on a branch)"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Occasionally the rebase button in the Gerrit UI is unable to automatically rebase changes on the working branch and you have to perform the rebase on the command line: </p> <div class="mw-highlight mw-highlight-lang-bash mw-content-ltr" dir="ltr"><pre><span></span><span class="c1"># First download the current change set</span> $<span class="w"> </span>git-review<span class="w"> </span>-d<span class="w"> </span><span class="m">424242</span> <span class="c1"># Next make sure you have a fresh copy of the target branch ("main" in this case)</span> $<span class="w"> </span>git<span class="w"> </span>fetch<span class="w"> </span>origin<span class="w"> </span>main <span class="c1"># Then rebase your change and fix any conflicts that may occur</span> $<span class="w"> </span>git<span class="w"> </span>rebase<span class="w"> </span>-i<span class="w"> </span>origin/main </pre></div> <div class="mw-heading mw-heading3"><h3 id="Manually_rebase_(on_parent)" data-mw-thread-id="h-Manually_rebase_(on_parent)-Working_on_an_existing_change_set"><span id="Manually_rebase_.28on_parent.29"></span><span data-mw-comment-start="" id="h-Manually_rebase_(on_parent)-Working_on_an_existing_change_set"></span>Manually rebase (on parent)<span data-mw-comment-end="h-Manually_rebase_(on_parent)-Working_on_an_existing_change_set"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=23" title="Edit section: Manually rebase (on parent)"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Sometimes the rebase button in the Gerrit UI is unable to automatically rebase a change in a change set on top of its parent and you have to perform the change on the command line. </p> <div class="mw-highlight mw-highlight-lang-bash mw-content-ltr" dir="ltr"><pre><span></span>$<span class="w"> </span><span class="nv">PARENT</span><span class="o">=</span><span class="m">424242</span> $<span class="w"> </span><span class="nv">CHILD</span><span class="o">=</span><span class="m">424243</span> <span class="c1"># First get a reference to the latest PS in the parent change and check it out.</span> <span class="c1"># You can get the link from the Gerrit UI: under the 'More' menu, select 'Download patch' and use the 'Checkout' link e.g.</span> $<span class="w"> </span>git<span class="w"> </span>fetch<span class="w"> </span><span class="s2">"https://gerrit.wikimedia.org/r/operations/puppet"</span><span class="w"> </span>refs/changes/<span class="nv">$i</span>/<span class="si">${</span><span class="nv">PARENT</span><span class="si">}</span>/<span class="si">${</span><span class="nv">PS</span><span class="si">}</span><span class="w"> </span><span class="o">&&</span><span class="w"> </span>git<span class="w"> </span>checkout<span class="w"> </span>FETCH_HEAD <span class="c1"># store this point in its own branch</span> $<span class="w"> </span>git<span class="w"> </span>branch<span class="w"> </span>merge_<span class="si">${</span><span class="nv">PARENT</span><span class="si">}</span> <span class="c1"># checkout the child change</span> $<span class="w"> </span>git-review<span class="w"> </span>-d<span class="w"> </span><span class="si">${</span><span class="nv">CHILD</span><span class="si">}</span> <span class="c1"># Rebase on the branch created earlier</span> $<span class="w"> </span>git<span class="w"> </span>rebase<span class="w"> </span>-i<span class="w"> </span>merge_<span class="si">${</span><span class="nv">PARENT</span><span class="si">}</span> <span class="c1"># upload the change</span> $<span class="w"> </span>git-review </pre></div> <div class="mw-heading mw-heading2 ext-discussiontools-init-section"><h2 id="Reviewing_code" data-mw-thread-id="h-Reviewing_code"><span data-mw-comment-start="" id="h-Reviewing_code"></span>Reviewing code<span data-mw-comment-end="h-Reviewing_code"></span></h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=24" title="Edit section: Reviewing code"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span><!--__DTELLIPSISBUTTON__{"threadItem":{"headingLevel":2,"name":"h-","type":"heading","level":0,"id":"h-Reviewing_code","replies":["h-Viewing_and_commenting_on_code-Reviewing_code","h-How_to_comment_on,_review,_and_merge_code_in_Eclipse-Reviewing_code","h-How_to_review_and_merge_code_via_command_line-Reviewing_code","h-Mass-approving_changes_across_repositories-Reviewing_code","h-Troubleshooting_2-Reviewing_code"]}}--></div> <div class="mw-heading mw-heading3"><h3 id="Viewing_and_commenting_on_code" data-mw-thread-id="h-Viewing_and_commenting_on_code-Reviewing_code"><span data-mw-comment-start="" id="h-Viewing_and_commenting_on_code-Reviewing_code"></span>Viewing and commenting on code<span data-mw-comment-end="h-Viewing_and_commenting_on_code-Reviewing_code"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=25" title="Edit section: Viewing and commenting on code"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The basic functionality is explained in <a href="/wiki/Special:MyLanguage/Gerrit/Tutorial#Viewing_and_commenting_on_code" title="Special:MyLanguage/Gerrit/Tutorial">the Git and Gerrit tutorial</a>. </p><p>Some extra bits: </p> <dl><dd><ul><li><b>Diff Against</b> dropdown menu. This menu will allow you to change what changes you are reviewing. This is helpful if you reviewed a past changeset, and want to make sure your changes were taken into account. Rather than reading through the entire changeset diff'd against the base commit, you can read only the differences between the current changeset and the changeset you reviewed. There's a bonus, too: You can see your comments on the left hand side. If there was a rebase commit, there will be garbage in the diffs, but you can read things one changeset at a time and it will still be faster.</li> <li><b>Open All</b> button:</li></ul> <dl><dd><ul><li>Opens the diff(s) in a new tab. You can double-click on a line and comment on that line, then save a draft comment! Then, click "Up to change" to go back to the changeset.</li> <li>For commits that contain whitespace changes (i.e. indent a block that was changed), it is best to set the diff-preferences appropriately to make it easier to review. When viewing a diff, on top there is a link "Preferences". Then there is two important settings to focus on. "<i>Ignore Whitespace</i>" and "<i>Intraline Difference</i>". The last one (<i>Intraline Difference</i>) is especially useful if a block of code was indented, as this setting will show the added tabs themselves allowing other changes to be recognizable without having to compare every word in your mind (see screenshot).</li></ul></dd></dl></dd></dl> <div class="mw-heading mw-heading3"><h3 id="How_to_comment_on,_review,_and_merge_code_in_Eclipse" data-mw-thread-id="h-How_to_comment_on,_review,_and_merge_code_in_Eclipse-Reviewing_code"><span id="How_to_comment_on.2C_review.2C_and_merge_code_in_Eclipse"></span><span data-mw-comment-start="" id="h-How_to_comment_on,_review,_and_merge_code_in_Eclipse-Reviewing_code"></span>How to comment on, review, and merge code in <a href="https://en.wikipedia.org/wiki/Eclipse_(software)" class="extiw" title="en:Eclipse (software)">Eclipse</a><span data-mw-comment-end="h-How_to_comment_on,_review,_and_merge_code_in_Eclipse-Reviewing_code"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=26" title="Edit section: How to comment on, review, and merge code in Eclipse"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <figure class="mw-default-size" typeof="mw:File/Thumb"><a href="/wiki/File:Gerrit-review-in-Eclipse-2.png" class="mw-file-description"><img src="//upload.wikimedia.org/wikipedia/mediawiki/thumb/1/1d/Gerrit-review-in-Eclipse-2.png/220px-Gerrit-review-in-Eclipse-2.png" decoding="async" width="220" height="134" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/mediawiki/thumb/1/1d/Gerrit-review-in-Eclipse-2.png/330px-Gerrit-review-in-Eclipse-2.png 1.5x, //upload.wikimedia.org/wikipedia/mediawiki/thumb/1/1d/Gerrit-review-in-Eclipse-2.png/440px-Gerrit-review-in-Eclipse-2.png 2x" data-file-width="1276" data-file-height="778"/></a><figcaption>Code review in Eclipse</figcaption></figure> <p>As an alternative to Gerrit's web interface, you can also review code from <a rel="nofollow" class="external text" href="http://www.eclipse.org/downloads/">Eclipse</a> using the <a rel="nofollow" class="external text" href="http://www.eclipse.org/mylyn/">Mylyn</a> task-management framework. To get started, download and install Eclipse, and then install Mylyn from the <a rel="nofollow" class="external text" href="http://help.eclipse.org/juno/index.jsp?topic=/org.eclipse.platform.doc.user/tasks/tasks-124.htm">Install New Software</a> menu (as of Oct 5th, 2013 you need the <a rel="nofollow" class="external text" href="http://download.eclipse.org/reviews/nightly">snapshots</a> update site to use the Wikimedia Gerrit installation). When you next launch Eclipse, you will be prompted to add a task for Mylyn. From there, you will need to install the connector for Gerrit, specify <code><a class="external free" href="https://gerrit.wikimedia.org/r/">https://gerrit.wikimedia.org/r/</a></code> as the server URL, and add your username and password. </p> <figure class="mw-default-size" typeof="mw:File/Thumb"><a href="/wiki/File:Gerrit-review-in-Eclipse.png" class="mw-file-description"><img src="//upload.wikimedia.org/wikipedia/mediawiki/thumb/4/4c/Gerrit-review-in-Eclipse.png/220px-Gerrit-review-in-Eclipse.png" decoding="async" width="220" height="134" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/mediawiki/thumb/4/4c/Gerrit-review-in-Eclipse.png/330px-Gerrit-review-in-Eclipse.png 1.5x, //upload.wikimedia.org/wikipedia/mediawiki/thumb/4/4c/Gerrit-review-in-Eclipse.png/440px-Gerrit-review-in-Eclipse.png 2x" data-file-width="1276" data-file-height="778"/></a><figcaption>Diff / comment interface in Eclipse</figcaption></figure> <p><br clear="all"/> </p> <div class="mw-heading mw-heading3"><h3 id="How_to_review_and_merge_code_via_command_line" data-mw-thread-id="h-How_to_review_and_merge_code_via_command_line-Reviewing_code"><span data-mw-comment-start="" id="h-How_to_review_and_merge_code_via_command_line-Reviewing_code"></span>How to review and merge code via command line<span data-mw-comment-end="h-How_to_review_and_merge_code_via_command_line-Reviewing_code"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=27" title="Edit section: How to review and merge code via command line"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Using <a class="external text" href="https://phabricator.wikimedia.org/diffusion/MDIP/repository/master/">dippy-bird</a> you can easily do command line review and merging. The query parameter is the change you want to deal with. </p> <div class="mw-highlight mw-highlight-lang-bash mw-content-ltr" dir="ltr"><pre><span></span>php<span class="w"> </span>dippy-bird.php<span class="w"> </span>--username<span class="o">=</span>USERNAME<span class="w"> </span>--server<span class="o">=</span>gerrit.wikimedia.org<span class="w"> </span>--port<span class="o">=</span><span class="m">29418</span><span class="w"> </span>--action<span class="o">=</span>submit<span class="w"> </span>--query<span class="o">=</span><span class="m">12345</span> </pre></div> <p>You can therefore use that to approve a range of commits: </p> <div class="mw-highlight mw-highlight-lang-bash mw-content-ltr" dir="ltr"><pre><span></span><span class="ch">#!/bin/bash</span> <span class="k">for</span><span class="w"> </span>i<span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="o">{</span><span class="m">51541</span>..51545<span class="o">}</span> <span class="k">do</span> <span class="w"> </span>php<span class="w"> </span>dippy-bird.php<span class="w"> </span>--username<span class="o">=</span>USERNAME<span class="w"> </span>--server<span class="o">=</span>gerrit.wikimedia.org<span class="w"> </span>--port<span class="o">=</span><span class="m">29418</span><span class="w"> </span>--action<span class="o">=</span>submit<span class="w"> </span>--query<span class="o">=</span><span class="nv">$i</span> <span class="k">done</span> </pre></div> <div class="mw-heading mw-heading3"><h3 id="Mass-approving_changes_across_repositories" data-mw-thread-id="h-Mass-approving_changes_across_repositories-Reviewing_code"><span data-mw-comment-start="" id="h-Mass-approving_changes_across_repositories-Reviewing_code"></span>Mass-approving changes across repositories<span data-mw-comment-end="h-Mass-approving_changes_across_repositories-Reviewing_code"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=28" title="Edit section: Mass-approving changes across repositories"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>We might sometimes have to generates a ton of changes, for example when doing a similar change on all our repositories. In the past, this happened after the MediaWiki extensions got migrated to Git since we had to add a <code>.gitreview</code> file to each repository. </p><p>First, you can query gerrit for a list of change using the CLI! A useful <a href="/wiki/Special:MyLanguage/Git/aliases" title="Special:MyLanguage/Git/aliases">alias</a>: </p> <pre>alias gerrit='ssh -p 29418 gerrit.wikimedia.org gerrit' </pre> <p>Then use that to execute a query such as all open changes on topic dotgitreview: </p> <pre>gerrit query 'status:open topic:dotgitreview' </pre> <p>With some shell magic, you can get a list of change number: </p> <pre>gerrit query 'status:open topic:dotgitreview' \ | egrep '^ number' | cut -d\ -f4- > CHANGES_NUMBERS </pre> <p>Then loop on them and remotely approve the changes: </p> <pre>for i in `cat CHANGES_NUMBERS`; do gerrit review --verified=+1 --code-review=+2 --submit "$i,1"; done </pre> <div class="mw-heading mw-heading3"><h3 id="Troubleshooting_2" data-mw-thread-id="h-Troubleshooting_2-Reviewing_code"><span data-mw-comment-start="" id="h-Troubleshooting_2-Reviewing_code"></span>Troubleshooting<span data-mw-comment-end="h-Troubleshooting_2-Reviewing_code"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=29" title="Edit section: Troubleshooting"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>For problems and how to solve them, see <a href="/wiki/Special:MyLanguage/Gerrit/Troubleshooting" title="Special:MyLanguage/Gerrit/Troubleshooting">Gerrit/Troubleshooting</a>. </p> <div class="mw-heading mw-heading2 ext-discussiontools-init-section"><h2 id="How_to_create_a_repository_("Gerrit_project")" data-mw-thread-id="h-How_to_create_a_repository_("Gerrit_project")"><span id="How_to_create_a_repository_.28.22Gerrit_project.22.29"></span><span data-mw-comment-start="" id="h-How_to_create_a_repository_("Gerrit_project")"></span>How to create a repository ("Gerrit project")<span data-mw-comment-end="h-How_to_create_a_repository_("Gerrit_project")"></span></h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=30" title="Edit section: How to create a repository ("Gerrit project")"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span><!--__DTELLIPSISBUTTON__{"threadItem":{"headingLevel":2,"name":"h-","type":"heading","level":0,"id":"h-How_to_create_a_repository_(\"Gerrit_project\")","replies":[]}}--></div> <p>See <a href="/wiki/Special:MyLanguage/Gerrit/New_repositories" title="Special:MyLanguage/Gerrit/New repositories">"Request a new Git repository"</a>. There's a form to fill out. It should get processed very quickly (within a couple of days). </p> <div class="mw-heading mw-heading2 ext-discussiontools-init-section"><h2 id="Other_tips" data-mw-thread-id="h-Other_tips"><span data-mw-comment-start="" id="h-Other_tips"></span>Other tips<span data-mw-comment-end="h-Other_tips"></span></h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=31" title="Edit section: Other tips"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span><!--__DTELLIPSISBUTTON__{"threadItem":{"headingLevel":2,"name":"h-","type":"heading","level":0,"id":"h-Other_tips","replies":["h-Gerrit_project_dashboard-Other_tips","h-Bookmarklet_to_hide_jenkins-bot_comments-Other_tips","h-Code_Review_links-Other_tips","h-Gerrit_review_scores-Other_tips","h-ssh_proxy_to_gerrit-Other_tips","h-Linking_Gerrit_URLs_from_Wikimedia_wikis_using_internal_link_syntax-Other_tips","h-Changing_the_user_associated_with_a_commit-Other_tips"]}}--></div> <div class="mw-heading mw-heading3"><h3 id="Gerrit_project_dashboard" data-mw-thread-id="h-Gerrit_project_dashboard-Other_tips"><span data-mw-comment-start="" id="h-Gerrit_project_dashboard-Other_tips"></span>Gerrit project dashboard<span data-mw-comment-end="h-Gerrit_project_dashboard-Other_tips"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=32" title="Edit section: Gerrit project dashboard"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>See also <a class="external text" href="https://gerrit.wikimedia.org/r/Documentation/user-dashboards.html">Documentation user-dashboards</a>.<br/> Each Gerrit repository has one or more dashboards that can be customised. The default dashboard is shown when you click on a project link anywhere in Gerrit. For example, clicking "mediawiki/core" on a commit page related to MediaWiki core will take you to <a class="external free" href="https://gerrit.wikimedia.org/r/q/project:mediawiki%252Fcore">https://gerrit.wikimedia.org/r/q/project:mediawiki%252Fcore</a>. </p><p>In Gerrit, dashboards are created in groups. Every repository inherits the "default" dashboard group from the "All-Projects" meta project. By default a project's default dashboard defaults to "default:recent". You can change what dashboard is used by default in the <code>project.config</code> file in the <code>refs/meta/config</code> branch of a repository. Detailed instructions are below. </p> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r6651107"><div role="note" class="note note-info">You can choose to manage your dashboard on-wiki instead of through a Git repository.<br/>Refer to <a href="/wiki/Module:Gerrit_dashboard" title="Module:Gerrit dashboard">Module:Gerrit dashboard</a> for more information.</div> <p>It is recommended to add the following aliases to your <code>.gitconfig</code> file. See <a href="/wiki/Special:MyLanguage/Git/aliases" title="Special:MyLanguage/Git/aliases">Git/aliases</a> for more information. </p> <div class="mw-highlight mw-highlight-lang-ini mw-content-ltr" dir="ltr"><pre><span></span><span class="k">[alias]</span> <span class="w"> </span><span class="na">dashboards-checkout</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">"!f() { git fetch origin refs/meta/dashboards/teams:refs/meta/dashboards/teams && git checkout -B meta/dashboards/teams refs/meta/dashboards/teams</span><span class="c1">; }; f"</span> <span class="w"> </span><span class="na">dashboards-review</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">"!f() { git push origin HEAD:refs/for/refs/meta/dashboards/teams</span><span class="c1">; }; f"</span> <span class="w"> </span><span class="na">dash-co</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">dashboards-checkout</span> <span class="w"> </span><span class="na">dash-review</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">dashboards-review</span> </pre></div> <div class="mw-heading mw-heading4"><h4 id="Manage_a_team_dashboard" data-mw-thread-id="h-Manage_a_team_dashboard-Gerrit_project_dashboard"><span data-mw-comment-start="" id="h-Manage_a_team_dashboard-Gerrit_project_dashboard"></span>Manage a team dashboard<span data-mw-comment-end="h-Manage_a_team_dashboard-Gerrit_project_dashboard"></span></h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=33" title="Edit section: Manage a team dashboard"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <ol><li>For Wikimedia teams, we use the <code>wikimedia</code> parent repository to host team dashboards. <ul><li>See <a class="external text" href="https://gerrit.wikimedia.org/r/admin/repos/wikimedia,dashboards">Gerrit team dashboards</a> to view examples.</li> <li>See <a class="external text" href="https://gerrit.wikimedia.org/g/wikimedia/+/refs/meta/dashboards/teams">wikimedia.git@refs/meta/dashboards/teams</a> for the source code (Browse these files for examples of the file format and queries.)</li> <li>See <a class="external text" href="https://gerrit.wikimedia.org/r/q/ref:%22%255Erefs/meta/dashboards/.*%22">Gerrit refs/meta/dashboard Code Review</a>.</li></ul></li> <li>Clone the repository if you haven't already, <code>git clone ssh://<gerrit-username>@gerrit.wikimedia.org:29418/wikimedia</code></li> <li>Check out the team dashboards branch <code>git dash-co</code></li> <li>Create (or edit) the dashboard configuration file for your team (lowercase with optional dashes, no file extension). See also <a class="external text" href="https://gerrit.wikimedia.org/r/Documentation/user-dashboards.html">Gerrit Documentation</a>.</li> <li>Stage your changes and make a local commit.</li> <li>Push the commit for review <code>git dash-review</code>. You can generally self-merge these, but you can also propose changes for others to review if you prefer.</li></ol> <p>Go to <a class="external text" href="https://gerrit.wikimedia.org/r/admin/repos/wikimedia,dashboards">Gerrit team dashboards</a> and click on your dashboard. Or use the following URL pattern: </p> <pre>https://gerrit.wikimedia.org/r/p/wikimedia/+/dashboard/teams:my-file-name </pre> <p>A bad configuration/syntax error shows up as a 404 on the relevant dashboard. Files can be validated with: </p> <pre>git config -f FILE --list </pre> <p><span class="anchor" id="Add_navigation_links"></span> </p> <div class="mw-heading mw-heading4"><h4 id="Add_team_dashboard_to_"Your"_menu" data-mw-thread-id="h-Add_team_dashboard_to_"Your"_menu-Gerrit_project_dashboard"><span id="Add_team_dashboard_to_.22Your.22_menu"></span><span data-mw-comment-start="" id="h-Add_team_dashboard_to_"Your"_menu-Gerrit_project_dashboard"></span>Add team dashboard to "Your" menu<span data-mw-comment-end="h-Add_team_dashboard_to_"Your"_menu-Gerrit_project_dashboard"></span></h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=34" title="Edit section: Add team dashboard to "Your" menu"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Add this to the "Your" menu in Gerrit for easy access: </p> <ol><li>Visit your <a class="external text" href="https://gerrit.wikimedia.org/r/settings/">Gerrit settings</a></li> <li>Navigate to the <a class="external text" href="https://gerrit.wikimedia.org/r/settings/#Menu">"Menu" section</a> of your settings.</li> <li>Add the url <code>/p/wikimedia/+/dashboard/teams:myteam</code> (for example) with a label that makes sense to you, like "My Team"</li> <li>Consider also adding <a class="external free" href="https://gerrit.wikimedia.org/r/admin/repos/wikimedia,dashboards">https://gerrit.wikimedia.org/r/admin/repos/wikimedia,dashboards</a> as "All Teams" to easily get to other dashboards.</li> <li>Click "Save Changes" and reload the browser tab.</li></ol> <div class="mw-heading mw-heading3"><h3 id="Bookmarklet_to_hide_jenkins-bot_comments" data-mw-thread-id="h-Bookmarklet_to_hide_jenkins-bot_comments-Other_tips"><span data-mw-comment-start="" id="h-Bookmarklet_to_hide_jenkins-bot_comments-Other_tips"></span>Bookmarklet to hide jenkins-bot comments<span data-mw-comment-end="h-Bookmarklet_to_hide_jenkins-bot_comments-Other_tips"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=35" title="Edit section: Bookmarklet to hide jenkins-bot comments"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Execute this JavaScript to hide all comments from jenkins-bot. Goes well with "Hide tagged comments" when you need to make sure all human feedback was addressed. Prefix with <code>javascript:</code> to add as a bookmarklet.<sup id="cite_ref-bookmarklet_1-0" class="reference"><a href="#cite_note-bookmarklet-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup> </p> <div class="mw-highlight mw-highlight-lang-js mw-content-ltr" dir="ltr"><pre><span></span><span class="nb">Array</span><span class="p">.</span><span class="kr">from</span><span class="p">(</span><span class="nb">document</span><span class="p">.</span><span class="nx">querySelectorAll</span><span class="p">(</span><span class="s1">'[class*=messageBox]'</span><span class="p">)).</span><span class="nx">filter</span><span class="p">(</span><span class="nx">box</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="nx">box</span><span class="p">.</span><span class="nx">querySelector</span><span class="p">(</span><span class="s1">'[class*=name]'</span><span class="p">).</span><span class="nx">textContent</span><span class="w"> </span><span class="o">===</span><span class="w"> </span><span class="s1">'jenkins-bot'</span><span class="p">).</span><span class="nx">forEach</span><span class="p">(</span><span class="nx">box</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="nx">box</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">display</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'none'</span><span class="p">)</span> </pre></div> <div class="mw-heading mw-heading3"><h3 id="Code_Review_links" data-mw-thread-id="h-Code_Review_links-Other_tips"><span data-mw-comment-start="" id="h-Code_Review_links-Other_tips"></span>Code Review links<span data-mw-comment-end="h-Code_Review_links-Other_tips"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=36" title="Edit section: Code Review links"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Links to old SVN <a href="https://www.mediawiki.org/wiki/Special:Code/MediaWiki/" class="extiw" title="rev:">Code Review</a> revisions are stored in commit notes. They may be fetched for display in the git log using the following command: </p> <div class="mw-highlight mw-highlight-lang-bash mw-content-ltr" dir="ltr"><pre><span></span>git<span class="w"> </span>fetch<span class="w"> </span>origin<span class="w"> </span>refs/notes/commits:refs/notes/commits </pre></div> <p>Note this must be done separately for each git repository. </p> <div class="mw-heading mw-heading3"><h3 id="Gerrit_review_scores" data-mw-thread-id="h-Gerrit_review_scores-Other_tips"><span data-mw-comment-start="" id="h-Gerrit_review_scores-Other_tips"></span>Gerrit review scores<span data-mw-comment-end="h-Gerrit_review_scores-Other_tips"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=37" title="Edit section: Gerrit review scores"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>As above, code review metadata is stored in commit notes and may be fetched using: </p> <div class="mw-highlight mw-highlight-lang-bash mw-content-ltr" dir="ltr"><pre><span></span>git<span class="w"> </span>fetch<span class="w"> </span>gerrit<span class="w"> </span>refs/notes/review:refs/notes/review </pre></div> <p>To retrieve them regularly, <a rel="nofollow" class="external text" href="https://git-scm.com/book/en/v2/Git-Internals-The-Refspec">add to your git config</a>. </p><p>To display them in <code>git log</code> (similar syntaxes work for related tools): </p> <div class="mw-highlight mw-highlight-lang-bash mw-content-ltr" dir="ltr"><pre><span></span>git<span class="w"> </span>log<span class="w"> </span>--notes<span class="o">=</span>review </pre></div> <div class="mw-heading mw-heading3"><h3 id="ssh_proxy_to_gerrit" data-mw-thread-id="h-ssh_proxy_to_gerrit-Other_tips"><span data-mw-comment-start="" id="h-ssh_proxy_to_gerrit-Other_tips"></span>ssh proxy to gerrit<span data-mw-comment-end="h-ssh_proxy_to_gerrit-Other_tips"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=38" title="Edit section: ssh proxy to gerrit"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>If gerrit is being slow, when it comes to uploading patches, it might be a network issue. (especially if you are in Europe, at certain times of the day) If you have a server / vm in the US or other proxy that you can use, then you can access gerrit via that. </p><p>In your ~/.ssh/config add something like: </p> <div class="mw-highlight mw-highlight-lang-text mw-content-ltr" dir="ltr"><pre><span></span>Host gerrit.wikimedia.org User aude Port 29418 Hostname gerrit.wikimedia.org IdentityFile=~/.ssh/gerrit ProxyCommand nc -x 127.0.0.1:8081 %h %p </pre></div> <p>Then connect to the proxy (e.g. via ssh, with the "-D 8081" option). Then it should work to access gerrit to upload / download patches and may be faster. </p> <div class="mw-heading mw-heading3"><h3 id="Linking_Gerrit_URLs_from_Wikimedia_wikis_using_internal_link_syntax" data-mw-thread-id="h-Linking_Gerrit_URLs_from_Wikimedia_wikis_using_internal_link_syntax-Other_tips"><span data-mw-comment-start="" id="h-Linking_Gerrit_URLs_from_Wikimedia_wikis_using_internal_link_syntax-Other_tips"></span>Linking Gerrit URLs from Wikimedia wikis using internal link syntax<span data-mw-comment-end="h-Linking_Gerrit_URLs_from_Wikimedia_wikis_using_internal_link_syntax-Other_tips"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=39" title="Edit section: Linking Gerrit URLs from Wikimedia wikis using internal link syntax"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>To link to Gerrit revision 1234 use [[gerrit:1234|revision 1234]]: <a href="https://gerrit.wikimedia.org/r/1234" class="extiw" title="gerrit:1234">revision 1234</a>. </p> <div class="mw-heading mw-heading3"><h3 id="Changing_the_user_associated_with_a_commit" data-mw-thread-id="h-Changing_the_user_associated_with_a_commit-Other_tips"><span data-mw-comment-start="" id="h-Changing_the_user_associated_with_a_commit-Other_tips"></span>Changing the user associated with a commit<span data-mw-comment-end="h-Changing_the_user_associated_with_a_commit-Other_tips"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=40" title="Edit section: Changing the user associated with a commit"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Gerrit will only accept patches committed under your registered email address. If you have multiple email addresses that you commit under (e.g. if you have "work" and "home" git settings that you want to keep distinct), you need to locally update the address you are committing under when you check out a repo. </p> <div class="mw-highlight mw-highlight-lang-shell mw-content-ltr" dir="ltr"><pre><span></span>git<span class="w"> </span>config<span class="w"> </span>user.email<span class="w"> </span>me@example.org </pre></div> <p>However, if you forget to do this after checking out and make a commit, you will need to update your configured email address and then fix that commit like so: </p> <div class="mw-highlight mw-highlight-lang-bash mw-content-ltr" dir="ltr"><pre><span></span>git<span class="w"> </span>commit<span class="w"> </span>--amend<span class="w"> </span>--no-edit<span class="w"> </span>--reset-author </pre></div> <p>If you want to avoid having to remember this, you can do the following in your <code>.gitconfig</code>: </p> <div class="mw-highlight mw-highlight-lang-ini mw-content-ltr" dir="ltr"><pre><span></span><span class="k">[includeIf "gitdir:~/src/mediawiki/"]</span> <span class="w"> </span><span class="na">path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">~/.gitconfig-mediawiki</span> </pre></div> <p>...and then create a .gitconfig-mediawiki: </p> <div class="mw-highlight mw-highlight-lang-ini mw-content-ltr" dir="ltr"><pre><span></span><span class="c1"># Anything in here will only be loaded in repos that are checked out under</span> <span class="c1"># ~/src/mediawiki/</span> <span class="k">[user]</span> <span class="w"> </span><span class="na">email</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">me@example.org</span> </pre></div> <p>You can add any other mediawiki-development specific commands there that you'd like. So long as you check out anything mediawiki-related into the <code>~/src/mediawiki</code> directory, that config file will be loaded and override your base gitconfig. </p> <div class="mw-heading mw-heading2 ext-discussiontools-init-section"><h2 id="See_also" data-mw-thread-id="h-See_also"><span data-mw-comment-start="" id="h-See_also"></span>See also<span data-mw-comment-end="h-See_also"></span></h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=41" title="Edit section: See also"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span><!--__DTELLIPSISBUTTON__{"threadItem":{"headingLevel":2,"name":"h-","type":"heading","level":0,"id":"h-See_also","replies":[]}}--></div> <ul><li><a href="/wiki/Special:MyLanguage/Git/Tips" title="Special:MyLanguage/Git/Tips">Git/Tips</a></li> <li><a href="/wiki/Special:MyLanguage/Gerrit/split_a_submitted_change" title="Special:MyLanguage/Gerrit/split a submitted change">Gerrit/split a submitted change</a></li> <li><a href="/wiki/Special:MyLanguage/Gerrit/watched_projects" title="Special:MyLanguage/Gerrit/watched projects">Gerrit/watched projects</a></li> <li><a href="/wiki/Special:MyLanguage/Gerrit/workflow/ops" title="Special:MyLanguage/Gerrit/workflow/ops">Gerrit/workflow/ops</a></li> <li>All pages under <a href="/wiki/Special:PrefixIndex/Git/" title="Special:PrefixIndex/Git/">Git/</a> and <a href="/wiki/Special:PrefixIndex/Gerrit/" title="Special:PrefixIndex/Gerrit/">Gerrit/</a></li> <li><a href="/wiki/Special:MyLanguage/Gerrit/Tutorial#See_also" title="Special:MyLanguage/Gerrit/Tutorial">Selection on externals links at the Git and Gerrit tutorial</a>.</li></ul> <div class="mw-heading mw-heading2 ext-discussiontools-init-section"><h2 id="Notes" data-mw-thread-id="h-Notes"><span data-mw-comment-start="" id="h-Notes"></span>Notes<span data-mw-comment-end="h-Notes"></span></h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Gerrit/Advanced_usage&action=edit&section=42" title="Edit section: Notes"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span><!--__DTELLIPSISBUTTON__{"threadItem":{"headingLevel":2,"name":"h-","type":"heading","level":0,"id":"h-Notes","replies":[]}}--></div> <div class="mw-references-wrap"><ol class="references"> <li id="cite_note-bookmarklet-1"><span class="mw-cite-backlink"><a href="#cite_ref-bookmarklet_1-0">↑</a></span> <span class="reference-text"> bookmarklets — browser bookmarks that execute JavaScript instead of opening a webpage.</span> </li> </ol></div> <!-- NewPP limit report Parsed by mw‐web.codfw.main‐74dc4d995d‐gmrhm Cached time: 20241104031709 Cache expiry: 2592000 Reduced expiry: false Complications: [show‐toc] DiscussionTools time usage: 0.043 seconds CPU time usage: 0.433 seconds Real time usage: 0.553 seconds Preprocessor visited node count: 2145/1000000 Post‐expand include size: 18061/2097152 bytes Template argument size: 7457/2097152 bytes Highest expansion depth: 17/100 Expensive parser function count: 40/500 Unstrip recursion depth: 0/20 Unstrip post‐expand size: 36966/5000000 bytes Lua time usage: 0.038/10.000 seconds Lua memory usage: 1301385/52428800 bytes Number of Wikibase entities loaded: 0/400 --> <!-- Transclusion expansion time report (%,ms,calls,template) 100.00% 236.582 1 -total 53.50% 126.576 1 Template:Git_and_Gerrit 51.29% 121.338 1 Template:Sidebar 31.38% 74.250 14 Template:Ll 19.30% 45.649 20 Template:Pagelang 13.54% 32.037 28 Template:Translatable 10.48% 24.804 5 Template:Dir 9.55% 22.584 4 Template:Note 7.90% 18.684 1 Template:See_also 6.61% 15.644 1 Template:Navbar --> <!-- Saved in parser cache with key mediawikiwiki:pcache:idhash:78737-0!canonical and timestamp 20241104031709 and revision id 6826076. Rendering was triggered because: page-view --> </div><!--esi <esi:include src="/esitest-fa8a495983347898/content" /> --><noscript><img src="https://login.wikimedia.org/wiki/Special:CentralAutoLogin/start?type=1x1" alt="" width="1" height="1" style="border: none; position: absolute;"></noscript> <div class="printfooter" data-nosnippet="">Retrieved from "<a dir="ltr" href="https://www.mediawiki.org/w/index.php?title=Gerrit/Advanced_usage&oldid=6826076">https://www.mediawiki.org/w/index.php?title=Gerrit/Advanced_usage&oldid=6826076</a>"</div></div> <div id="catlinks" class="catlinks" data-mw="interface"><div id="mw-normal-catlinks" class="mw-normal-catlinks"><a href="/wiki/Special:Categories" title="Special:Categories">Categories</a>: <ul><li><a href="/wiki/Category:Git" title="Category:Git">Git</a></li><li><a href="/wiki/Category:Gerrit" title="Category:Gerrit">Gerrit</a></li></ul></div></div> </div> </main> </div> <div class="mw-footer-container"> <footer id="footer" class="mw-footer" > <ul id="footer-info"> <li id="footer-info-lastmod"> This page was last edited on 4 November 2024, at 03:00.</li> <li id="footer-info-copyright">Text is available under the <a rel="nofollow" class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en">Creative Commons Attribution-ShareAlike License</a>; additional terms may apply. Text in <a class="external text" href="https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents">the Help: namespace</a> is available under the <a rel="nofollow" class="external text" href="https://creativecommons.org/publicdomain/zero/1.0/">Creative Commons CC0 License</a>. By using this site, you agree to the <a class="external text" href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Terms_of_Use">Terms of Use</a> and <a class="external text" href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy">Privacy Policy</a>.</li> </ul> <ul id="footer-places"> <li id="footer-places-privacy"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy">Privacy policy</a></li> <li id="footer-places-about"><a href="/wiki/Project:About">About mediawiki.org</a></li> <li id="footer-places-disclaimers"><a href="/wiki/Project:General_disclaimer">Disclaimers</a></li> <li id="footer-places-wm-codeofconduct"><a href="https://www.mediawiki.org/wiki/Special:MyLanguage/Code_of_Conduct">Code of Conduct</a></li> <li id="footer-places-developers"><a href="https://developer.wikimedia.org">Developers</a></li> <li id="footer-places-statslink"><a href="https://stats.wikimedia.org/#/www.mediawiki.org">Statistics</a></li> <li id="footer-places-cookiestatement"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Cookie_statement">Cookie statement</a></li> <li id="footer-places-mobileview"><a href="//m.mediawiki.org/w/index.php?title=Gerrit/Advanced_usage&mobileaction=toggle_view_mobile" class="noprint stopMobileRedirectToggle">Mobile view</a></li> </ul> <ul id="footer-icons" class="noprint"> <li id="footer-copyrightico"><a href="https://wikimediafoundation.org/" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><img src="/static/images/footer/wikimedia-button.svg" width="84" height="29" alt="Wikimedia Foundation" loading="lazy"></a></li> <li id="footer-poweredbyico"><a href="https://www.mediawiki.org/" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><img src="/w/resources/assets/poweredby_mediawiki.svg" alt="Powered by MediaWiki" width="88" height="31" loading="lazy"></a></li> </ul> </footer> </div> </div> </div> <div class="vector-settings" id="p-dock-bottom"> <ul></ul> </div><script>(RLQ=window.RLQ||[]).push(function(){mw.config.set({"wgHostname":"mw-web.codfw.main-cc877b49b-rsfkp","wgBackendResponseTime":139,"wgDiscussionToolsPageThreads":[{"headingLevel":2,"name":"h-","type":"heading","level":0,"id":"h-Warning","replies":[]},{"headingLevel":2,"name":"h-","type":"heading","level":0,"id":"h-Installation","replies":[{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-Setup_SSH_shortcut_(optional)-Installation","replies":[]}]},{"headingLevel":2,"name":"h-S_Page_(WMF)-2013-05-17T02:28:00.000Z","type":"heading","level":0,"id":"h-Submitting_patches-2013-05-17T02:28:00.000Z","replies":[{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-Setting_up_a_repository_for_git-remote-Submitting_patches","replies":[]},{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-Howto_-_Merging_your_amend_back_into_your_branch-Submitting_patches","replies":[]},{"headingLevel":3,"name":"h-S_Page_(WMF)-2013-05-17T02:28:00.000Z","type":"heading","level":0,"id":"h-Submitting_a_change_to_a_branch_for_review_(\"backporting\")-Submitting_patches-2013-05-17T02:28:00.000Z","replies":[{"timestamp":"2013-05-17T02:28:00.000Z","author":"S Page (WMF)","type":"comment","level":2,"id":"c-S_Page_(WMF)-2013-05-17T02:28:00.000Z-Submitting_a_change_to_a_branch_for_review_(\"backporting\")","replies":[]}]},{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-Acting_on_remote_branches-Submitting_patches","replies":[{"headingLevel":4,"name":"h-","type":"heading","level":0,"id":"h-Pushing_having_used_automatic_setup-Acting_on_remote_branches","replies":[]},{"headingLevel":4,"name":"h-","type":"heading","level":0,"id":"h-Pushing_having_used_manual_(Windows)_setup-Acting_on_remote_branches","replies":[]}]},{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-Committing_to_non_master-Submitting_patches","replies":[]},{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-Partial_revert_of_previous_commit-Submitting_patches","replies":[]},{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-Unlink_bogus_dependencies_(rebase_changes)-Submitting_patches","replies":[]},{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-Create_a_dependency-Submitting_patches","replies":[]},{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-Cross-project_dependencies-Submitting_patches","replies":[]},{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-Splitting_a_commit_into_smaller_ones-Submitting_patches","replies":[]},{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-Removing_your_local_branch_after_submitting_your_change_into_Gerrit-Submitting_patches","replies":[]},{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-Merging_a_submodule_into_a_parent_project-Submitting_patches","replies":[]},{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-Using_a_personal_sandbox_for_personal_branches-Submitting_patches","replies":[]},{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-Troubleshooting-Submitting_patches","replies":[]}]},{"headingLevel":2,"name":"h-","type":"heading","level":0,"id":"h-Working_on_an_existing_change_set","replies":[{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-Manually_rebase_(on_a_branch)-Working_on_an_existing_change_set","replies":[]},{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-Manually_rebase_(on_parent)-Working_on_an_existing_change_set","replies":[]}]},{"headingLevel":2,"name":"h-","type":"heading","level":0,"id":"h-Reviewing_code","replies":[{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-Viewing_and_commenting_on_code-Reviewing_code","replies":[]},{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-How_to_comment_on,_review,_and_merge_code_in_Eclipse-Reviewing_code","replies":[]},{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-How_to_review_and_merge_code_via_command_line-Reviewing_code","replies":[]},{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-Mass-approving_changes_across_repositories-Reviewing_code","replies":[]},{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-Troubleshooting_2-Reviewing_code","replies":[]}]},{"headingLevel":2,"name":"h-","type":"heading","level":0,"id":"h-How_to_create_a_repository_(\"Gerrit_project\")","replies":[]},{"headingLevel":2,"name":"h-","type":"heading","level":0,"id":"h-Other_tips","replies":[{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-Gerrit_project_dashboard-Other_tips","replies":[{"headingLevel":4,"name":"h-","type":"heading","level":0,"id":"h-Manage_a_team_dashboard-Gerrit_project_dashboard","replies":[]},{"headingLevel":4,"name":"h-","type":"heading","level":0,"id":"h-Add_team_dashboard_to_\"Your\"_menu-Gerrit_project_dashboard","replies":[]}]},{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-Bookmarklet_to_hide_jenkins-bot_comments-Other_tips","replies":[]},{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-Code_Review_links-Other_tips","replies":[]},{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-Gerrit_review_scores-Other_tips","replies":[]},{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-ssh_proxy_to_gerrit-Other_tips","replies":[]},{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-Linking_Gerrit_URLs_from_Wikimedia_wikis_using_internal_link_syntax-Other_tips","replies":[]},{"headingLevel":3,"name":"h-","type":"heading","level":0,"id":"h-Changing_the_user_associated_with_a_commit-Other_tips","replies":[]}]},{"headingLevel":2,"name":"h-","type":"heading","level":0,"id":"h-See_also","replies":[]},{"headingLevel":2,"name":"h-","type":"heading","level":0,"id":"h-Notes","replies":[]}],"wgPageParseReport":{"discussiontools":{"limitreport-timeusage":"0.043"},"limitreport":{"cputime":"0.433","walltime":"0.553","ppvisitednodes":{"value":2145,"limit":1000000},"postexpandincludesize":{"value":18061,"limit":2097152},"templateargumentsize":{"value":7457,"limit":2097152},"expansiondepth":{"value":17,"limit":100},"expensivefunctioncount":{"value":40,"limit":500},"unstrip-depth":{"value":0,"limit":20},"unstrip-size":{"value":36966,"limit":5000000},"entityaccesscount":{"value":0,"limit":400},"timingprofile":["100.00% 236.582 1 -total"," 53.50% 126.576 1 Template:Git_and_Gerrit"," 51.29% 121.338 1 Template:Sidebar"," 31.38% 74.250 14 Template:Ll"," 19.30% 45.649 20 Template:Pagelang"," 13.54% 32.037 28 Template:Translatable"," 10.48% 24.804 5 Template:Dir"," 9.55% 22.584 4 Template:Note"," 7.90% 18.684 1 Template:See_also"," 6.61% 15.644 1 Template:Navbar"]},"scribunto":{"limitreport-timeusage":{"value":"0.038","limit":"10.000"},"limitreport-memusage":{"value":1301385,"limit":52428800}},"cachereport":{"origin":"mw-web.codfw.main-74dc4d995d-gmrhm","timestamp":"20241104031709","ttl":2592000,"transientcontent":false}}});});</script> </body> </html>