
Friends I'm stuck with Git. Help please! Simon I tried to do a 'git stash pop', having just done a 'git pull' from the master repo. I got this: simonpj@cam-05-unx:~/code/HEAD-2$ git stash pop warning: Failed to merge submodule utils/haddock (commits don't follow merge-base) Auto-merging utils/haddock CONFLICT (submodule): Merge conflict in utils/haddock Auto-merging compiler/typecheck/TcRnMonad.lhs Now git status says simonpj@cam-05-unx:~/code/HEAD-2$ git status # On branch master # Your branch is ahead of 'origin/master' by 2 commits. # # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: compiler/typecheck/TcMType.lhs # modified: compiler/typecheck/TcRnMonad.lhs # modified: compiler/typecheck/TcSimplify.lhs # modified: compiler/typecheck/TcUnify.lhs # # Unmerged paths: # (use "git reset HEAD <file>..." to unstage) # (use "git add/rm <file>..." as appropriate to mark resolution) # # 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)

Hey Simon, If you have no Haddock changes, try cd'ing into the haddock directory and doing a hard reset to the remote origin (so something like git reset --hard origin/master *INSIDE HADDOCK*), and then changing back to the main directory and git add'ing the directory. Edward Excerpts from Simon Peyton Jones's message of 2014-04-14 02:13:02 -0700:
Friends I'm stuck with Git. Help please! Simon
I tried to do a 'git stash pop', having just done a 'git pull' from the master repo. I got this:
simonpj@cam-05-unx:~/code/HEAD-2$ git stash pop
warning: Failed to merge submodule utils/haddock (commits don't follow merge-base)
Auto-merging utils/haddock
CONFLICT (submodule): Merge conflict in utils/haddock
Auto-merging compiler/typecheck/TcRnMonad.lhs Now git status says
simonpj@cam-05-unx:~/code/HEAD-2$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 2 commits.
#
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: compiler/typecheck/TcMType.lhs
# modified: compiler/typecheck/TcRnMonad.lhs
# modified: compiler/typecheck/TcSimplify.lhs
# modified: compiler/typecheck/TcUnify.lhs
#
# Unmerged paths:
# (use "git reset HEAD <file>..." to unstage)
# (use "git add/rm <file>..." as appropriate to mark resolution)
#
# 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)

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

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
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@haskell.org http://www.haskell.org/mailman/listinfo/ghc-devs

Thank you – that’s helpful. It’s the mental model that I miss!
Simon
From: Iavor Diatchki [mailto:iavor.diatchki@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
# 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@haskell.orgmailto:ghc-devs@haskell.org http://www.haskell.org/mailman/listinfo/ghc-devs
participants (4)
-
Edward Z. Yang
-
Herbert Valerio Riedel
-
Iavor Diatchki
-
Simon Peyton Jones