Page MenuHomePhabricator

Micro-task: Amend existing commit in Gerrit
Closed, ResolvedPublic

Description

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 T248232.) 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. I have created a commit and pushed it to Gerrit: 585759.

Your task is to fetch the patch to your machine, add your Phabricator username to tests/selenium/README.md, amend the commit and push it back to Gerrit.

Go to the mediawiki/core folder in your terminal. (You have cloned the repository in T248232.)

cd mediawiki/core

Fetch the patch.

git review -d 585759

Add your Phabricator username to tests/selenium/README.md. Use your favorite text editor.

nvim tests/selenium/README.md

Amend the commit. Do not change the commit message.

git add tests/selenium/README.md
git commit --amend

Push the amended commit back to Gerrit.

git review -R

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

Students:

Related Objects

Event Timeline

Thanks @Aklapper, I was just looking for that. 😄

Change 585759 had a related patch set uploaded (by Zfilipin; owner: Zfilipin):
[mediawiki/core@master] WIP Micro-task: Amend existing commit in Gerrit

https://gerrit.wikimedia.org/r/585759

Hey @zeljkofilipin , can we link multiple tasks under one commit using the

Bug: <task number>

In T249323#6027066, @AlQaholic007 wrote:

Hey @zeljkofilipin , can we link multiple tasks under one commit using the

Bug: <task number>

Yes, just add multiple lines that start with Bug: . Why do you need it for this task?

In T249323#6027066, @AlQaholic007 wrote:

Hey @zeljkofilipin , can we link multiple tasks under one commit using the

Bug: <task number>

Yes, just add multiple lines that start with Bug: . Why do you need it for this task?

Not for this task. Was asking in general if it were possible to link a commit to multiple tasks

@zeljkofilipin Only +2ers are able to modify other people's patches. I assume the intended objective is to learn to amend a patch instead of making multiple commits in a chain (like is the convention on GitHub, with a sqaushed merge afterwards).

Maybe part of this should be to first create your own patch, push to gerrit, and then amend that patch set, and push again (PS2).

@zeljkofilipin Only +2ers are able to modify other people's patches. I assume the intended objective is to learn to amend a patch instead of making multiple commits in a chain (like is the convention on GitHub, with a sqaushed merge afterwards).

Maybe part of this should be to first create your own patch, push to gerrit, and then amend that patch set, and push again (PS2).

I faced the same issue. I added a sub-task to this task taking reference from T230916: Cannot amend Gerrit changeset in MediaWiki Core repo (due to not being in addPatchSet?). Turns out there is some permission issue @Krinkle

@zeljkofilipin Only +2ers are able to modify other people's patches. I assume the intended objective is to learn to amend a patch instead of making multiple commits in a chain (like is the convention on GitHub, with a sqaushed merge afterwards).

Maybe part of this should be to first create your own patch, push to gerrit, and then amend that patch set, and push again (PS2).

That’s not correct, you have to be in the trusted user group to add to someone else change.

Change 585865 had a related patch set uploaded (by Ashuro07; owner: Zfilipin):
[mediawiki/core@master] T249323

https://gerrit.wikimedia.org/r/585865

This comment was removed by Ashuro07.
zeljkofilipin claimed this task.
zeljkofilipin updated the task description. (Show Details)

Change 585759 abandoned by Zfilipin:
WIP Micro-task: Amend existing commit in Gerrit

Reason:
Than you everybody!

https://gerrit.wikimedia.org/r/585759