Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a subproject commit?

Tags:

git

github

I'm trying to add the Laravel files to a Github repo.

I ran

$ git clone https://github.com/laravel/laravel.git

The files show up fine locally but do not show up when I push to github:

enter image description here

The commit shows:

enter image description here

How can I add the laravel files to my github repo? Also, what is a subproject commit?

like image 871
Connor Leech Avatar asked Jan 13 '14 10:01

Connor Leech


People also ask

What is subproject in git?

A subproject is a generic term for one of three types of nesting: Submodules provide semi-fixed references from the superproject into subprojects and are integrated into git.

How do submodules work?

A git submodule is a record within a host git repository that points to a specific commit in another external repository. Submodules are very static and only track specific commits. Submodules do not track git refs or branches and are not automatically updated when the host repository is updated.

What is a sub repository?

Subrepositories is a feature that allows you to treat a collection of repositories as a group. This will allow you to clone, commit to, push, and pull projects and their associated libraries as a group.

Are git submodules a good idea?

Git submodules may look powerful or cool upfront, but for all the reasons above it is a bad idea to share code using submodules, especially when the code changes frequently. It will be much worse when you have more and more developers working on the same repos.


Video Answer


2 Answers

A submodule commit is a gitlink, special entry recorded in the index, created when you add a submodule to your repo;

It records the SHA1 currently referenced by the parent repo.

A git submodule update --init is enough to populate the laravel subdirectory in your repo.

Once it is filled, note that your submodule repo is in a detached HEAD mode.

As shown here, when switching branches in the parent repo, your submodule gitlink will change accordingly, but your submodule content won't change until you make again a git submodule update (after the git checkout)

like image 77
VonC Avatar answered Oct 11 '22 21:10

VonC


It means the repository uses Submodules.

To pull down the Laravel code, try

git submodule init git submodule update 

Submodules are notoriously prickly; I recommend reading up on them before working too much on a project that uses them. The link above should be a good starting point.

like image 23
Chris Avatar answered Oct 11 '22 20:10

Chris