![]() ![]() ![]() Then, you commit this in order to tell git that you want your repository to work with this version of the submodule:Īs long as you don't do this the repository will stay with the old versions of the submodules (even if your copy "works" with the new version).īefore you push any changes to code that depends on your locally committed changes in a submodule, you should push these submodule changes to the remote. To tell git that changes in the submodules (no matter whether you committed them locally or pulled) should be part of the repository that you are working, you have to add and commit these changes.įor this, you simply add the submodule folder to your index like any other folder that contains changes that you want to commit: This means that pulling submodule updates only affects your local copy. This great power also comes with an additional responsibility: As long as you don't tell git that you want your repository to depend on a new version of a submodule it will keep the old version. (If you want to rebase instead of merging, you should read the section on submodules in the "Pro Git" book!)Īdd and commit submodule changes (local or pulled)Īs stated in the intro, git submodules have an important advantage over svn externals. Merge submodule changes before committing and pushing them git submodule update -remote -merge Prosuming submodule changes change and commit in submodules Therefore, it's best to simply always checkout directly after cloning a submodule.) (If you don't do this before changing stuff, then you have to merge with a branch as soon as you want to push local commits. To locally get all changes that were done in submodules:īefore producing submodule changes checkout a branch for a submoduleīefore you start to change something in a submodule you have to checkout a branch in the submodule folder: Working with existing submodules consuming submodule changes pull upstream changes of submodules To work with submodules without understanding them, you can: You can read the section on submodules in the "Pro Git" book to understand what you can do with submodules. In contrast to svn externals, git submodules do not always include the most recent code from another repository but exactly the version you want. With git you can use so-called submodules to make a specific snapshot of a git repository part of another git repository. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |