tim peterson
tim peterson

Reputation: 24305

Make hidden git repository viewable

Sorry for such an easy question but how do I make a git repository I've added locally viewable in my master?

Details:

  1. the repo, in this case "stripe-php", is actually inside another repo, my application.
  2. visualizing the problem: the "stripe-php" hidden repo is colored gray-black instead of light-blue on github's website.

So this is hidden:

hidden repo

this is viewable:

viewable repo

Upvotes: 1

Views: 2239

Answers (1)

VonC
VonC

Reputation: 1323115

Submodule is a good way to reference a fixed point in another repo history.
See "True nature of submodules".

Adding a submodule isn't enough, you must initialize it and update it:

git submodule update --init

You can also declare a submodule in order to follow a certain branch of ots upstream repo.
See "git submodule tracking latest".

If you have already declared a submodule without taking advantage of that option, see "How to make an existing submodule track a branch".


If you pull from GitHub, a simple git submodule update --init on your server in your live repo is enough to update your submodules.

Actually, the full command would be:

git submodule update --init --recursive --force

If you push directly to your server, to see a submodule updated in a live server, you need to have:

  • a bare repo (you can clone, on your server, your current repo which represents your live files, but which doesn't yet display the submodule content, with the --bare option, and push to that bare repo from your client)

  • a post-receive hook similar to what I describe in "Git submodule on remote bare".

That would be:

cd /path/to/your/bare/repo.git
$ cat > hooks/post-receive

#!/bin/sh
GIT_DIR=/path/to/live/repo/.git
GIT_WORK_TREE=/path/to/live/repo
cd /path/to/live/repo
git pull /path/to/your/bare/repo.git
git submodule update

$ chmod +x hooks/post-receive

Upvotes: 1

Related Questions