Moving a copy of the Git work containing the submodule

Recent changes in Git have changed the way the .git directory is handled when using submodules.
Now, everything is in the “root level”.git directory (with the submodule In the directory corresponding to the working copy), instead of having a .git for each submodule.

Then, in each submodule, create a file pointing to the new location of the .git directory. /p>

In my project, I have the following .gitmodules files:

[submodule "tests/shared-tests"]
path = tests/shared -tests
url = git://github.com/roboptim/roboptim-shared-tests.git
[submodule "cmake"]
path = cmake
url = git: //github.com/jrl-umi3218/jrl-cmakemodules.git

When I do git clone –recursive, I get:

$cat cmake/.git
gitdir: /home/moulard/profiles/default-x86_64-linux-ubuntu-12.04.1/src/unstable/roboptim/roboptim-core/.git/modules/cmake

< p>I am currently using Git 1.8.1.5.

My question is:

>Why has this behavior changed? I don’t see any obvious benefits from this new strategy.
>How can I safely move my working copy? (If I move my working copy, I will receive an error message telling me that the path of the damaged gitdir is no longer a Git repository)

Please note that this is the same as the previous question Moving the parent directory of a git repository that contains submodules is different, because I am sure that this is not the problem involved in the existence of absolute paths in my .gitmodules file.

The history of .git / module organization can be traced back to git1.7.8 (December 2d, 2011):

When populating a new submodule directory with “git submodule init”, the $GIT_DIR metainformation directory for submodules is created inside $GIT_DIR/modules// directory of the superproject and referenced via the gitfile mechanism.
This is to make it possible to switch between commits in the superproject that has and does not have the submodule in the tree without re-cloning .

However, recent bug fixes have been included in 1.8.2.1 and 1.8.3 (April 22, 2013):

< blockquote>

“git submodule update”, when recursed into sub-submodules, did not acccumulate the prefix paths.

So upgrading to the latest git version can solve this problem.

Here, OP Thomas Moulard mentioned a possible solution in the comments (using the latest git 1.8.3, 2013 April 22):

$git submodule deinit -f . is working!
Then I can run git submodule init and the paths get fixed

If (de)initialization step (.git/modules), this requires attention

It will not be processed “Add” step, this step records the URL of the submodule in the .gitmodules file: you still need to manually delete it in the file.

Recent Git changes change the usage How to handle .git directories when submodules.
Now, everything is in the “root-level” .git directory (the directory corresponding to the working copy that contains the submodule), instead of having a .git for each submodule

Then, in each submodule, create a file pointing to the new location of the .git directory.

In my project, I have the following .gitmodules file:< /p>

[submodule "tests/shared-tests"]
path = tests/shared-tests
url = git://github.com/roboptim/ roboptim-shared-tests.git
[submodule "cmake"]
path = cmake
url = git://github.com/jrl-umi3218/jrl-cmakemodules.git

When I do git clone –recursive, I get:

$cat cmake/.git
gitdir: /home/moulard/profiles/default -x86_64-linux-ubuntu-12.04. 1/src/unstable/roboptim/roboptim-core/.git/modules/cmake

I am currently using Git 1.8.1.5.

My question is:

>Why has this behavior changed? I don’t see any obvious benefits from this new strategy.
>How can I safely move my working copy? (If I move my working copy, I will receive an error message telling me that the path of the damaged gitdir is no longer a Git repository)

Please note that this is the same as the previous question Moving the parent directory of a git repository that contains submodules is different because I am sure that this is not the problem involved in the existence of absolute paths in my .gitmodules file.

.git / module The history of the organization can be traced back to git1.7.8 (December 2d, 2011):

When populating a new submodule directory with “git submodule init “, the $GIT_DIR metainformation directory for submodules is created inside $GIT_DIR/modules// directory of the superproject and referenced via the gitfile mechanism.
This is to make it possible to switch between commits in the superproject that has and does not have the submodule in the tree without re-cloning.

However, recent bug fixes have been included in 1.8.2.1 and 1.8.3 (April 22, 2013):

“git submodule update”, when recursed into sub-submodules, did not acccumulate the prefix paths.

So upgrading to the latest git version can solve this problem.

Here, OP Thomas Moulard is in the comm ents mentioned a possible solution (using the latest git 1.8.3, April 22, 2013):

$git submodule deinit -f . is working!
Then I can run git submodule init and the paths get fixed

If (de)initialization step ( .git / modules), this requires attention

It will not process the “add” step, which records the URL of the submodule in the .gitmodules file: you still need to manually delete it in the file.

p>

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 4242 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.