Re: [git-users] Empty Commit?

2013-10-23 Thread PJ Weisberg
On Oct 22, 2013 5:39 PM, PJ Weisberg p...@irregularexpressions.net wrote:

 On Tue, Oct 22, 2013 at 1:55 PM, Vicki Kozel vickiko...@gmail.com wrote:

 Hi Marcelo,
 I do not want to abandon this change, I want to keep it and the commit
unchanged. I think this is a good practice in Gerrit to keep adding patches
to the same change - to the same commit - which allows for better change
tracking and tighter code gating.


 You can't add patches to the same commit.  A commit is one snapshot.

 If you do a normal commit, your branch will have two commits: the one
with that introduces the bad change, and another one that undoes it.

 If you do a commit with '--amend', like you're trying to do now, your
branch will have only one commit, which introduces no changes whatsoever.
You can certainly do that.  Git tells you how in the error message you
quoted.  It just seems like a silly thing to do, so Git is asking you if
you're really sure you want to do it.

If I were in your place, I would use --amend, not to undo the commit, but
to fix it so that it does what it was intended to do without whatever bug
was uncovered.  That way the history would show one state where the feature
was not implemented, then another where it was implemented. The --amend
serves to overwrite or replace the intermediate state, where the feature is
implemented incorrectly.

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[git-users] Empty Commit?

2013-10-22 Thread Vicki Kozel
Hello,
we are using Git and Gerrit stack; since Gerrit is good about keeping track 
of an individual commits(changes), when a commit breaks CI, Gerrit a) 
prevents the change to be merged into master b)provides a patch branch a 
developer can checkout and amend the broken commit.

I got into the situation when I made a change A that broke that build, so 
gerrit never merged the change into a master. I then checked out a patch 
with my change in it on top of history and reverted my change A to look 
like it looked before (and equivalent to a current master). git status 
tells me that I do have a modified file in my branch. But git commit 
tells me that my commit is empty.

Is this because the SHA1 of the fixed file on my branch and SHA1 of the 
same file on the master are identical? To fix the situation I just add an 
empty line to a reverted file, to make it look a little different from 
master, and then git does not complain about an empty commit. What is the 
right practice in a situation like this?

Thank you.
Vicki

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [git-users] Empty Commit?

2013-10-22 Thread William Seiti Mizuta
Hi Vicky,

have you added your modified files to changes to be commited state? What
is the output of git status command?


William Seiti Mizuta
@williammizuta
Caelum | Ensino e Inovação
www.caelum.com.br


On Tue, Oct 22, 2013 at 1:01 PM, Vicki Kozel vickiko...@gmail.com wrote:

 Hello,
 we are using Git and Gerrit stack; since Gerrit is good about keeping
 track of an individual commits(changes), when a commit breaks CI, Gerrit a)
 prevents the change to be merged into master b)provides a patch branch a
 developer can checkout and amend the broken commit.

 I got into the situation when I made a change A that broke that build,
 so gerrit never merged the change into a master. I then checked out a patch
 with my change in it on top of history and reverted my change A to look
 like it looked before (and equivalent to a current master). git status
 tells me that I do have a modified file in my branch. But git commit
 tells me that my commit is empty.

 Is this because the SHA1 of the fixed file on my branch and SHA1 of the
 same file on the master are identical? To fix the situation I just add an
 empty line to a reverted file, to make it look a little different from
 master, and then git does not complain about an empty commit. What is the
 right practice in a situation like this?

 Thank you.
 Vicki

 --
 You received this message because you are subscribed to the Google Groups
 Git for human beings group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to git-users+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [git-users] Empty Commit?

2013-10-22 Thread William Seiti Mizuta
On Tue, Oct 22, 2013 at 2:20 PM, Vicki Kozel vickiko...@gmail.com wrote:

 git commit COMMON/pom.xml --amend


You don't need to pass the file in commit command. You just need to use
git commit --amend


William Seiti Mizuta
@williammizuta
Caelum | Ensino e Inovação
www.caelum.com.br

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [git-users] Empty Commit?

2013-10-22 Thread Vicki Kozel
Thank you William,
I just tried that - same outcome.
Vicki

On Tuesday, October 22, 2013 11:24:29 AM UTC-7, William Seiti Mizuta wrote:


 On Tue, Oct 22, 2013 at 2:20 PM, Vicki Kozel vicki...@gmail.comjavascript:
  wrote:

 git commit COMMON/pom.xml --amend


 You don't need to pass the file in commit command. You just need to use 
 git commit --amend


 William Seiti Mizuta
 @williammizuta
 Caelum | Ensino e Inovação
 www.caelum.com.br
  

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [git-users] Empty Commit?

2013-10-22 Thread Vicki Kozel
Also, my file on the branch that I am amending looks exactly like the file 
in master. I checked their SHA1 signatures with git hash-object command - 
they are identical. Maybe that what is causing the problem?

On Tuesday, October 22, 2013 11:53:25 AM UTC-7, Vicki Kozel wrote:

 Thank you William,
 I just tried that - same outcome.
 Vicki

 On Tuesday, October 22, 2013 11:24:29 AM UTC-7, William Seiti Mizuta wrote:


 On Tue, Oct 22, 2013 at 2:20 PM, Vicki Kozel vicki...@gmail.com wrote:

 git commit COMMON/pom.xml --amend


 You don't need to pass the file in commit command. You just need to use 
 git commit --amend


 William Seiti Mizuta
 @williammizuta
 Caelum | Ensino e Inovação
 www.caelum.com.br
  


-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [git-users] Empty Commit?

2013-10-22 Thread PJ Weisberg
On Oct 22, 2013 11:21 AM, Vicki Kozel vickiko...@gmail.com wrote:

 This is what git status shows after I modified the file and ran git add:

  git status
 # On branch fix99
 # Changes to be committed:
 #   (use git reset HEAD file... to unstage)
 #
 # modified:   COMMON/pom.xml
 #


 This is what git commit with amend shows:

 git commit COMMON/pom.xml --amend
 # On branch fix99
 # No changes
 You asked to amend the most recent commit, but doing so would make
 it empty. You can repeat your command with --allow-empty, or you can
 remove the commit entirely with git reset HEAD^.

It's because you added the --amend option.  You're telling git that you
want a commit that introduces no changes, and git is asking if you're
really sure about that, and suggesting something you might want to do
instead.

It sounds to me like what you want to do is just not merge the commit into
master.  I.e., do nothing.  Why are you even working with this branch if
you're just trying to discard it?

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [git-users] Empty Commit?

2013-10-22 Thread Marcelo Avila
Hi Vicki,

You're trying to amend your commit (which was previously pushed to Gerrit)
but your new commit (the amend) would have the exact same tree as its
parent commit (see --allow-empty item in git help commit). In this
case, you do NOT need to amend your commit, you just need to abandon the
original one by clicking in the *Abandon Change* button in Gerrit UI.

--
*Marcelo Ávila de Oliveira*
CPqD - Information Technology Engineer
Tel.: +55 19 3705-4125
mav...@cpqd.com.br
www.cpqd.com.br


2013/10/22 William Seiti Mizuta william.miz...@gmail.com

 Yes, that might be the cause. Then, you can discard the last commit with
 git reset --hard HEAD^ or create an empty commit with git commit
 --allow-empty


 William Seiti Mizuta
 @williammizuta
 Caelum | Ensino e Inovação
 www.caelum.com.br


 On Tue, Oct 22, 2013 at 2:55 PM, Vicki Kozel vickiko...@gmail.com wrote:

 Also, my file on the branch that I am amending looks exactly like the
 file in master. I checked their SHA1 signatures with git hash-object
 command - they are identical. Maybe that what is causing the problem?


 On Tuesday, October 22, 2013 11:53:25 AM UTC-7, Vicki Kozel wrote:

 Thank you William,
 I just tried that - same outcome.
 Vicki

 On Tuesday, October 22, 2013 11:24:29 AM UTC-7, William Seiti Mizuta
 wrote:


 On Tue, Oct 22, 2013 at 2:20 PM, Vicki Kozel vicki...@gmail.comwrote:

 git commit COMMON/pom.xml --amend


 You don't need to pass the file in commit command. You just need to use
 git commit --amend


 William Seiti Mizuta
 @williammizuta
 Caelum | Ensino e Inovação
 www.caelum.com.br

  --
 You received this message because you are subscribed to the Google Groups
 Git for human beings group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to git-users+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


  --
 You received this message because you are subscribed to the Google Groups
 Git for human beings group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to git-users+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [git-users] Empty Commit?

2013-10-22 Thread Vicki Kozel
Hi Marcelo,
I do not want to abandon this change, I want to keep it and the commit 
unchanged. I think this is a good practice in Gerrit to keep adding patches 
to the same change - to the same commit - which allows for better change 
tracking and tighter code gating.  

On Tuesday, October 22, 2013 12:22:07 PM UTC-7, Marcelo Avila wrote:

 Hi Vicki,

 You're trying to amend your commit (which was previously pushed to Gerrit) 
 but your new commit (the amend) would have the exact same tree as its 
 parent commit (see --allow-empty item in git help commit). In this 
 case, you do NOT need to amend your commit, you just need to abandon the 
 original one by clicking in the *Abandon Change* button in Gerrit UI.

 --
 *Marcelo Ávila de Oliveira*
 CPqD - Information Technology Engineer
 Tel.: +55 19 3705-4125
 mav...@cpqd.com.br javascript:
 www.cpqd.com.br
  

 2013/10/22 William Seiti Mizuta william...@gmail.com javascript:

 Yes, that might be the cause. Then, you can discard the last commit with 
 git reset --hard HEAD^ or create an empty commit with git commit 
 --allow-empty

  
 William Seiti Mizuta
 @williammizuta
 Caelum | Ensino e Inovação
 www.caelum.com.br


 On Tue, Oct 22, 2013 at 2:55 PM, Vicki Kozel vicki...@gmail.comjavascript:
  wrote:

 Also, my file on the branch that I am amending looks exactly like the 
 file in master. I checked their SHA1 signatures with git hash-object 
 command - they are identical. Maybe that what is causing the problem?


 On Tuesday, October 22, 2013 11:53:25 AM UTC-7, Vicki Kozel wrote:

 Thank you William,
 I just tried that - same outcome.
 Vicki

 On Tuesday, October 22, 2013 11:24:29 AM UTC-7, William Seiti Mizuta 
 wrote:


 On Tue, Oct 22, 2013 at 2:20 PM, Vicki Kozel vicki...@gmail.comwrote:

 git commit COMMON/pom.xml --amend


 You don't need to pass the file in commit command. You just need to 
 use git commit --amend


 William Seiti Mizuta
 @williammizuta
 Caelum | Ensino e Inovação
 www.caelum.com.br
  
  -- 
 You received this message because you are subscribed to the Google 
 Groups Git for human beings group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to git-users+...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.


  -- 
 You received this message because you are subscribed to the Google Groups 
 Git for human beings group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to git-users+...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [git-users] Empty Commit?

2013-10-22 Thread Marcelo Avila
But in this special case the amended commit you are planning to push to
Gerrit is equal to the original commit you have based in to make your
previous commit. You do not need to make the same commit again to fix your
change, just abandon it on Gerrit.

--
Marcelo Ávila de Oliveira
mav...@cpqd.com.br
Em 22/10/2013 18:55, Vicki Kozel vickiko...@gmail.com escreveu:

 Hi Marcelo,
 I do not want to abandon this change, I want to keep it and the commit
 unchanged. I think this is a good practice in Gerrit to keep adding patches
 to the same change - to the same commit - which allows for better change
 tracking and tighter code gating.

 On Tuesday, October 22, 2013 12:22:07 PM UTC-7, Marcelo Avila wrote:

 Hi Vicki,

 You're trying to amend your commit (which was previously pushed to
 Gerrit) but your new commit (the amend) would have the exact same tree as
 its parent commit (see --allow-empty item in git help commit). In this
 case, you do NOT need to amend your commit, you just need to abandon the
 original one by clicking in the *Abandon Change* button in Gerrit UI.

 --
 *Marcelo Ávila de Oliveira*
 CPqD - Information Technology Engineer
 Tel.: +55 19 3705-4125
 mav...@cpqd.com.br
 www.cpqd.com.br


 2013/10/22 William Seiti Mizuta william...@gmail.com

 Yes, that might be the cause. Then, you can discard the last commit with
 git reset --hard HEAD^ or create an empty commit with git commit
 --allow-empty


 William Seiti Mizuta
 @williammizuta
 Caelum | Ensino e Inovação
 www.caelum.com.br


 On Tue, Oct 22, 2013 at 2:55 PM, Vicki Kozel vicki...@gmail.com wrote:

 Also, my file on the branch that I am amending looks exactly like the
 file in master. I checked their SHA1 signatures with git hash-object
 command - they are identical. Maybe that what is causing the problem?


 On Tuesday, October 22, 2013 11:53:25 AM UTC-7, Vicki Kozel wrote:

 Thank you William,
 I just tried that - same outcome.
 Vicki

 On Tuesday, October 22, 2013 11:24:29 AM UTC-7, William Seiti Mizuta
 wrote:


 On Tue, Oct 22, 2013 at 2:20 PM, Vicki Kozel vicki...@gmail.comwrote:

 git commit COMMON/pom.xml --amend


 You don't need to pass the file in commit command. You just need to
 use git commit --amend


 William Seiti Mizuta
 @williammizuta
 Caelum | Ensino e Inovação
 www.caelum.com.br

  --
 You received this message because you are subscribed to the Google
 Groups Git for human beings group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to git-users+...@**googlegroups.com.
 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .


  --
 You received this message because you are subscribed to the Google
 Groups Git for human beings group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to git-users+...@**googlegroups.com.
 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .


  --
 You received this message because you are subscribed to the Google Groups
 Git for human beings group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to git-users+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.