Git problem

Simon Peyton Jones simonpj at microsoft.com
Thu Apr 17 07:37:49 UTC 2014


Thank you – that’s helpful.  It’s the mental model that I miss!

Simon

From: Iavor Diatchki [mailto:iavor.diatchki at gmail.com]
Sent: 16 April 2014 16:44
To: Herbert Valerio Riedel
Cc: Simon Peyton Jones; ghc-devs
Subject: Re: Git problem

Hello,

I think the commands Herbert suggested should help.  I find it useful to have a mental model of what's going on with git, so here is a brief explanation, in case it is useful.

The main observation is that Git not only keeps track of the state of all files in the repo, but also the states of all related repositories (aka, the sub-modules).  So this is probably what happened:

1. `git stash`: Git remembered which files were modified, and the current commit for `haddock` (and other sub-modules)
2. `git pull`: Git got some changes for the remote server, and it happened that the current commit for `haddock` changed.
3. `git pop`: Git needs to apply the saved changes but in the new setting.   It managed to automatically merge the modified files, but it does not know which is the correct current commit for haddock: do you want to use the newly downloaded version, or the one that was saved when you created the stash?

So Herbert's commands tell it what to do:  the first command tells it to set the current commit for haddock to the one in the remote repo (i.e., you are not interested in the stashed version);   the second command tells it to remember this, so that the change will be committed later.

Cheers,
-Iavor











On Mon, Apr 14, 2014 at 2:47 AM, Herbert Valerio Riedel <hvriedel at gmail.com<mailto:hvriedel at gmail.com>> wrote:
On 2014-04-14 at 11:13:02 +0200, Simon Peyton Jones wrote:

[...]

> #    both modified:      utils/haddock

> The modified files are right.  It's the "both modified utils/haddock" that is messing me up.
> I'm not modifying haddock!  I just want to say "take the master haddock", but I don't know how.  I tried 'git checkout utils/haddock' but that just led do `git status' saying
>
> #    modified:   utils/haddock (new commits)
Fyi, the git equivalent of saying "take the master haddock" (where
'master' refers to 'master' of 'haddock.git'):

  # checkout master of haddock.git:
  git submodule update --remote utils/haddock

  # register state (= submod commit-id) of utils/haddock for next commit
  git add utils/haddock

HTH, hvr
_______________________________________________
ghc-devs mailing list
ghc-devs at haskell.org<mailto:ghc-devs at haskell.org>
http://www.haskell.org/mailman/listinfo/ghc-devs

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20140417/cd85a5e8/attachment-0001.html>


More information about the ghc-devs mailing list