Wireshark-dev: Re: [Wireshark-dev] Advice needed regarding git push to gerrit

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Wed, 6 Jan 2016 15:19:07 -0800
On Jan 6, 2016, at 2:52 PM, Paul Offord <Paul.Offord@xxxxxxxxxxxx> wrote:

> I’m trying to upload a patch set to gerrit.  The git status before I do the upload is:
> 
> C:\Development\Wireshark>git status
> On branch bug11968
> Changes to be committed:
>   (use "git reset HEAD <file>..." to unstage)
>  
>         modified:   epan/plugin_if.c
>         modified:   epan/plugin_if.h
>         modified:   ui/qt/main_window.cpp
>         modified:   ui/qt/main_window.h
> 
> When I run the git push I get this:
> 
> C:\Development\Wireshark>git push ssh://PaulOfford@xxxxxxxxxxxxxxxxxx:29418/wireshark HEAD:refs/for/master/bug11968
> Enter passphrase for key '/c/Users/aslpjo/.ssh/id_rsa':
> Counting objects: 176, done.
> Delta compression using up to 4 threads.
> Compressing objects: 100% (71/71), done.
> Writing objects: 100% (176/176), 73.10 KiB | 0 bytes/s, done.
> Total 176 (delta 152), reused 128 (delta 105)
> remote: Resolving deltas: 100% (152/152)
> remote: Processing changes: refs: 1, done
> To ssh://PaulOfford@xxxxxxxxxxxxxxxxxx:29418/wireshark
> ! [remote rejected] HEAD -> refs/for/master/bug11968 (no new changes)
> error: failed to push some refs to 'ssh://PaulOfford@xxxxxxxxxxxxxxxxxx:29418/wireshark'
> 
> What am I doing wrong?

Not doing a "git commit" before the "git push".  You've staged your changes, but you haven't committed them yet, as per "Changes to be committed".

With CVS and SVN, if you're going to be working with code for which there's a remote "official" repository, you check out a tree from the remote repository, and when you commit changes, they go into the remote repository.

with Git (and possibly with other "distributed" version control systems), you don't check out a tree from a remote repository, you "clone" the remote repository, so you have your own repository.  "Committing" means "checking into your own personal local repository", and sending changes to a *remote* repository is done with a separate operation - either a "push", where you send your changes to the remote repository, or a "pull", where the people maintaining the remote repository pull your changes from your repository (which, for them, is the remote repository) to their repository (which, for them, is the local repository).