git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "W. Trevor King" <wking@tremily.us>
To: shawn wilson <ag4ve.us@gmail.com>
Cc: Git List <git@vger.kernel.org>
Subject: Re: submodules
Date: Thu, 23 Jan 2014 09:20:14 -0800	[thread overview]
Message-ID: <20140123172014.GS29063@odin.tremily.us> (raw)
In-Reply-To: <CAH_OBicG4bLWu_C=uF6bTzzdJP5SSZ=odQF-qsP4n+VvAN4nrQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2002 bytes --]

On Thu, Jan 23, 2014 at 03:38:49AM -0500, shawn wilson wrote:
> My issue is in trying to update the submodules, I'm getting:
>  % git submodule update --init
>                                                 gits/kt (master ⚡)
> swlap1
> fatal: reference is not a tree: 98f1e9f99fca32ab3de901219eb2f600d38ab3a5
> Unable to checkout '98f1e9f99fca32ab3de901219eb2f600d38ab3a5' in
> submodule path 'repo_a'
> 
> Ok, so a bit of googling and I found this:
> http://stackoverflow.com/questions/13425298/git-submodule-update-fatal-error-reference-is-not-a-tree
> Ok, so update the repo that contains the submodules every time you
> push from a sub repo? How / where do I create a hook to do this?

You've got it switched.  You *did* push the superproject, but forgot
to push the new submodule commits that it references.  An easy way to
avoid this problem is to always push the superproject using:

  $ git push --recurse-submodules=on-demand …

If you no longer have access to the submodule repositories that
weren't pushed, you'll have to roll back the superproject so it
references submodule commits that were pushed.  The easiest way to do
this is probably to just cd into the submodule directory and checkout
an appropriate commit (e.g. origin/master):

  $ cd repo_a
  $ git fetch origin
  $ git checkout origin/master

That will put you on a detached HEAD, so you might want to replace the
checkout with:

  $ git checkout -B master origin/master

or some such to get a local branch.

Then cd back into the superproject and commit the submodule
(referencing the current submodule commit):

  $ cd ..
  $ git commit -m 'repo_a: Roll back to last public commit' repo_a

When you push that commit, don't forget to push everything ;)

  $ git push --recurse-submodules=on-demand

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2014-01-23 17:20 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-23  8:38 submodules shawn wilson
2014-01-23 17:20 ` W. Trevor King [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-05-03 13:45 submodules shawn wilson
2013-05-03 19:51 ` submodules Jens Lehmann
2007-08-07 22:37 Submodules Dmitry Kakurin
2007-08-07 22:49 ` Submodules Johannes Schindelin
2007-08-07 23:10   ` Submodules Dmitry Kakurin
2007-08-08 10:27     ` Submodules Sven Verdoolaege
2007-08-07 22:50 ` Submodules Johannes Schindelin
2007-08-07 23:31   ` Submodules Dmitry Kakurin
2007-08-08  0:07     ` Submodules Johannes Schindelin
2007-08-08 10:41     ` Submodules Sven Verdoolaege
2007-08-08 19:33       ` Submodules Junio C Hamano
2007-08-08 19:40         ` Submodules Johannes Schindelin
2007-08-08 19:59           ` Submodules Junio C Hamano
2007-08-08 20:08             ` Submodules Sven Verdoolaege
2007-08-08 22:08               ` Submodules Junio C Hamano
2007-08-08 22:18                 ` Submodules Johannes Schindelin
2007-08-08 20:27             ` Submodules Junio C Hamano
2007-08-08 20:47           ` Submodules Andy Parkins
2007-08-08 21:12             ` Submodules Johannes Schindelin
2007-08-09  5:44               ` Submodules Sven Verdoolaege
2007-08-08 19:53         ` Submodules Sven Verdoolaege

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140123172014.GS29063@odin.tremily.us \
    --to=wking@tremily.us \
    --cc=ag4ve.us@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).