Page MenuHomePhabricator

Amend existing commit in Gerrit
Closed, ResolvedPublic

Description

This is a microtask for T256626: Refactor WebdriverIO tests from sync to async mode. See that task for more information and how to get help.

In Github, an unit of work is pull request. When you start work on a bug or a feature, you create a new git branch and several commits in a branch. When you're happy with the work, you merge the branch to the master branch.

In Gerrit, an unit of work is a commit. Similar to Github, you create a new git branch and a commit in it. When you have some code, you should push it to Gerrit. (That is covered in task T293258: Push a commit to Gerrit.) If you want to make changes, you don't create new commits in the branch. Instead you amend the existing commit. You can amend the commit many times. When you're happy with the work, you merge the commit to the master branch.

This task will introduce you to the Gerrit workflow of amending a commit. You have created a commit and pushed it to Gerrit in {T293258: Push a commit to Gerrit}.

Your task is to fetch the commit from Gerrit to your machine, make any change to the commit (like editing or creating a file), amend the commit and push it back to Gerrit.

Go to the test/test folder in your terminal. (You have cloned the repository in T293258: Push a commit to Gerrit.)

cd test

Fetch the commit. My commit is at https://gerrit.wikimedia.org/r/c/test/test/+/730561. Your commit will have a different URL. You can get commit number from the URL.

git review -d 730561

Make any change, like editing or creating a file.

code readme.md

Amend the commit. Do not change the commit message.

git add readme.md
git commit --amend

Push the amended commit back to Gerrit.

git review

For more information see Gerrit/Tutorial: Amending a change (your own or someone else's).

Commits and pastes

Tasks

previous T293258: Push a commit to Gerrit | next T292853: Run Selenium tests targeting MediaWiki Core in MediaWiki-Docker

Event Timeline

zeljkofilipin updated the task description. (Show Details)
Osamaahmed17 updated the task description. (Show Details)
Osamaahmed17 subscribed.
zeljkofilipin claimed this task.