transrefa.blogg.se

Git add remote submodule
Git add remote submodule









git add remote submodule
  1. #GIT ADD REMOTE SUBMODULE HOW TO#
  2. #GIT ADD REMOTE SUBMODULE FREE#

If needed, create the parent directory of the new location of the submodule (`mkdir -p **new/path/to**`).

git add remote submodule

$ git mv **old/path/to/module** **new/path/to/module**Įdit `.gitmodules` and change the path of the submodule appropriately, and put it in the index with `git add.

  • Tidying up your local and remote repository.
  • Reflog - Restoring commits not shown in git log.
  • Display commit history graphically with Gitk.
  • mailmap file: Associating contributor and email aliases
  • Cloning a Git repository having submodules.
  • #GIT ADD REMOTE SUBMODULE FREE#

  • Git on the server – Setting up the serverįor questions and suggestions feel free to leave a comment.
  • If you want to know more about the commands and concepts discussed in this tutorial you can check out the following resources: Now we can add Library1 as a submodule from the root directory of Project: git submodule add src/libs/Library1įinally we can commit and push our changes git commit -m "Replaced Library1 directory with submodule." Git commit -m "Removed Library1 directory to replace it with submodule." Go into the root directory of Project and type the following commands: git rm -r src/libs/Library1/ It’s time to remove the Library1/ directory from Project as we’re going to replace it with a submodule. git push origin masterĪt this point Library1 is an independent git repository. Then we can push all the Library1 files and populate its remote repository.

    git add remote submodule

    Git remote add origin PUSH FILES TO REMOTE REPOSITORY git filter-branch -subdirectory-filter src/libs/Library1 -allĪs we are working on a clone of Project, origin is still pointing to the remote repository of Project. We want to remove that and make origin point to the new remote repository of Library1. Now it’s time to rewrite the repository to look as if Library1/ had been its project root, and discard all other history. The second step is cloning the Project repository to work on a new copy. Here /path/to/git/repos/ is the directory storing all the git repositories on your server. The following instructions assume that you are doing this on some server from the shell. The first thing to do is creating a new empty repository for Library1.

    #GIT ADD REMOTE SUBMODULE HOW TO#

    The following steps are based on the repository introduced in the previous section.They will explain how to turn a subdirectory of a project into an independent git repository and how to use this new repository as submodule, a foreign repository embedded within a dedicated subdirectory of the source tree of a project. From repository subdirectory to git submodule Maybe at some point you’ll want to make Library1 an independent git repository to share it with other projects preserving its previous history.Ī pretty easy way to achieve this is using git filter branch and git sumbmodule as explained in the next section. If you work with git repositories it’s probably only a matter of time until you’ll need/want to refactor them in order to share some parts or to create new repositories.įor example you have a repository with a layout similar to this one: Project/ This tutorial explains how to extract a subdirectory of a git repository and how to make it a submodule or an independent git repository in 8 easy steps.











    Git add remote submodule