[Numpy-discussion] Commit rights on github

David david at silveregg.co.jp
Tue Oct 12 00:37:49 EDT 2010


On 10/12/2010 11:12 AM, Charles R Harris wrote:
>
>
> On Mon, Oct 11, 2010 at 7:31 PM, David <david at silveregg.co.jp
> <mailto:david at silveregg.co.jp>> wrote:
>
>     On 10/12/2010 08:48 AM, Charles R Harris wrote:
>      >
>      >
>      > On Mon, Oct 11, 2010 at 5:09 PM, Pierre GM <pgmdevlist at gmail.com
>     <mailto:pgmdevlist at gmail.com>
>      > <mailto:pgmdevlist at gmail.com <mailto:pgmdevlist at gmail.com>>> wrote:
>      >
>      >
>      >     On Oct 12, 2010, at 1:06 AM, Pauli Virtanen wrote:
>      >
>      > > Mon, 11 Oct 2010 23:30:31 +0200, Pierre GM wrote:
>      > >> Would any of you mind giving me commit rights on github? My
>      >     handle is
>      > >> pierregm. Thanks a million in advance.
>      > >
>      > > Granted.
>      >
>      >     Got it, thanks again!
>      >
>      >
>      > Umm, I think your first commit changed a lot more than you intended.
>
>     Indeed. Pierre, please revert this commit, and then commit what you
>     intended:
>
>     git revert   # will revert
>     all your changes
>     git cherry-pick -n 61d945bdb5c9b2b3329e1b8468b5c7d0596dd9fc # apply the
>     changes introduced by 61d945..., but do not commit
>
>     Then, check that you don't add unnecessary files (eclipse files) before
>     committing again. A good way to check what you are about to commit is to
>     do git diff --stat --cached,
>
>
> I can't quite figure out what commit a14dd542532d383610c1
> <http://github.com/numpy/numpy/commit/a14dd542532d383610c1b01c5698b137dd058fea>
> did or where it applied. Any hints?

It is a merge commit:

"""
commit a14dd542532d383610c1b01c5698b137dd058fea
Merge: 61d945b 11ee694
Author: pierregm <pierregmcode at gmail.com>
Date:   Mon Oct 11 23:02:10 2010 +0200

     merging refs/remotes/origin/master into HEAD
"""

You can see that it has two parents (61d945b and 11ee694). 61d945b is 
another commit by PGM, whereas 11ee694 refers to the last "clean" commit 
by Pauli. For example, you can see this using the --graph option of git log:

*   commit a14dd542532d383610c1b01c5698b137dd058fea
|\  Merge: 61d945b 11ee694
| | Author: pierregm <pierregmcode at gmail.com>
| | Date:   Mon Oct 11 23:02:10 2010 +0200
| |
| |     merging refs/remotes/origin/master into HEAD
| |
| * commit 11ee694744f2552d77652ed929fdc2b4ccca6843
| | Author: Pauli Virtanen <pav at iki.fi>
| | Date:   Mon Oct 11 00:40:13 2010 +0200
| |

...
| * commit 4510c4a81185eed7e144f75ec5121f80bc924a6e
| | Author: Pauli Virtanen <pav at iki.fi>
| | Date:   Fri Oct 1 11:15:38 2010 +0200
| |
| |     sphinxext: fix Other Parameters section parsing in docscrape
| |
* | commit 61d945bdb5c9b2b3329e1b8468b5c7d0596dd9fc
|/  Author: pierregm <pierregmcode at gmail.com>
|   Date:   Mon Oct 11 22:24:26 2010 +0200
|
|       Add more tests to test_eq_w_None (bug #1493)


So by doing:

git revert a14dd542532d383610c1b01c5698b137dd058fea -m 2

You are telling git to revert to its second parent (here 11ee6947). I 
don't know exactly what PGM did, maybe he mistakenly "unmerge" all the 
changes made from 61d945 and commit this.

In that case, a way to avoid this mistake is to do the following:

   * make changes on your own git repository clone
   * once you have a set of changesets of commits, first update your 
branch from upstream (a bit like svn up) with git pull: at that point, 
git will try to merge your changes and upstream changes if there are 
divergences. You could also use the --rebase option of git pull, with 
the usual rebase caveats w.r.t. changes

See here for a relatively clear explanation: 
http://yehudakatz.com/2010/05/13/common-git-workflows/, "Updating from 
the remote" section,

cheers,

David



More information about the NumPy-Discussion mailing list