Re: amend a commit and upload it

96 views
Skip to first unread message

Bruce Zu

unread,
Mar 28, 2013, 5:44:07 AM3/28/13
to repo-d...@googlegroups.com
try:
'git push origin HEAD:refs/for/master'

 check
'git status '
to see which branch you are now.

which version of Gerrit you are using?

what is aosp?

"Everything up-to-date" means nothing has been pushed to Gerrit.  you have not new commit in local branch.






On Thursday, March 28, 2013 3:00:24 PM UTC+8, jst...@gmail.com wrote:
I'm new to repo/git/gerrit etc...

I just submitted my first patch to aosp and need to do a few minor modifications to the commit.

I have downloaded the commit, modified it and recommitted it to my local repository, but when I do git push aosp, it says "Everything up-to-date". But when I go to the page on android-review, it doesn't show anything new uploaded. What am I missing?

Here is my process:

1. sync with aosp master, and sync my local working directory and make sure all files match the master branch, so everything is 'untouched'
2. git fetch <project url> <refs/changes...> && git checkout FETCH_HEAD
3. open the now modifiedsource files (they now show the changes from the last commit)
4. edit the source files
5. git add .
6. git commit --amend
7. edit the commit message
8. git push aosp

Then I get: "Everything up-to-date". But going back to the url of my project/changes still only shows the most recent activity besides what I just tried to upload.

Any help is appreciated. I've been googling to high hell and just can't find the answer to where I am going wrong...

Magnus Bäck

unread,
Mar 28, 2013, 9:26:45 AM3/28/13
to repo-d...@googlegroups.com
On Thursday, March 28, 2013 at 03:00 EDT,
jst...@gmail.com wrote:

> I'm new to repo/git/gerrit etc...
>
> I just submitted my first patch to aosp and need to do a few minor
> modifications to the commit.
>
> I have downloaded the commit, modified it and recommitted it to my
> local repository, but when I do git push aosp, it says "Everything
> up-to-date". But when I go to the page on android-review, it doesn't
> show anything new uploaded. What am I missing?
>
> Here is my process:
>
> 1. sync with aosp master, and sync my local working directory and make
> sure all files match the master branch, so everything is 'untouched'
> 2. git fetch <project url> <refs/changes...> && git checkout FETCH_HEAD
> 3. open the now modifiedsource files (they now show the changes from
> the last commit)
> 4. edit the source files
> 5. git add .

Watch out; this will add *all* files from the current directory
and subdirectories. In many cases this isn't what you want. If
you know you've only modified already tracked files it's safer
to use "git commit -a". It's also one command less to type.

> 6. git commit --amend
> 7. edit the commit message
> 8. git push aosp

This will push all local branches with names that match remote
branches (see git-push(1)). New patch sets are pushed the same
way as new changes, so in your case you should run:

git push aosp HEAD:refs/for/master

[...]

--
Magnus Bäck
ba...@google.com

Magnus Bäck

unread,
Mar 28, 2013, 11:11:13 AM3/28/13
to repo-d...@googlegroups.com
On Thursday, March 28, 2013 at 10:57 EDT,
jst...@gmail.com wrote:

> ok "git push aosp HEAD:refs/for/master" worked. Thanks!
>
> "git commit -a" didn't bring up the old commit message as a default
> draft, so I worried that was going to submit a new commit,

You would have. In your case "git commit -a --amend" would've
been the easiest way to amend your most recent commit with all
local changes in tracked files.

> so I just did "git commit --amend". Maybe "git add <something here>"
> wasn't necessary because I only modified a single file, and that file
> was already included in the commit?

No, you must always add a changed file to the index to have
it included in a commit, either explicitly via "git add" or
implicitly via "git commit -a". This applies regardless of
whether the file is already tracked or if it's a brand new
file.

--
Magnus Bäck
ba...@google.com
Reply all
Reply to author
Forward
0 new messages