Gerrit - How can multiple local commits push as single Gerrit change?

3,383 views
Skip to first unread message

Richard

unread,
Jan 5, 2011, 3:07:12 PM1/5/11
to Repo and Gerrit Discussion
For example:

1) Git clone to client
2) Work and git commit. (commit 1)
3) Go to sleep
4) Continue work and git commit (commit 2)
5) Git push to Gerrit refs/for/master
6) Go to Gerrit web page and get two changes for review

My question is that how can we only have one single change in Gerrit
even for multiple local commits?

BTW, we are not using "repo", only pure git.

Thanks,
Richard

Anatol Pomazau

unread,
Jan 7, 2011, 2:14:03 PM1/7/11
to Richard, Repo and Gerrit Discussion
On Wed, Jan 5, 2011 at 12:07 PM, Richard <richar...@gmail.com> wrote:
For example:

1) Git clone to client
2) Work and git commit. (commit 1)
3) Go to sleep
4) Continue work and git commit (commit 2)
5) Git push to Gerrit refs/for/master
6) Go to Gerrit web page and get two changes for review

I assume that you worked on the same project and just want to join your two changes.

For that instead of second commit you should do "git commit --amend" --amend means apply your changes on top of the HEAD commit. So you actually will never have commit #2.
 

My question is that how can we only have one single change in Gerrit
even for multiple local commits?

BTW, we are not using "repo", only pure git.

Thanks,
Richard

Swindells, Thomas

unread,
Jan 7, 2011, 3:22:12 PM1/7/11
to Anatol Pomazau, Richard, Repo and Gerrit Discussion

The other option is to do an interactive rebase and squash them together

git rebase –i origin/master

 

Thomas




**************************************************************************************
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postm...@nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00
**************************************************************************************
Reply all
Reply to author
Forward
0 new messages