![]() So that's the solution-checkout a branch first (even if it's master), do your work and push. Dont forget to add a correct pushurl for the you are working on or you will not be able to commit.This means that the checked-out commit - which is the one that the super-project (core) needs - is not associated with a local branch name. It's like checking out a tag: the head is detached, so you're not working on a branch. By default your submodule repository is in a state called detached HEAD. ![]() One major difference between "submodule update" and "submodule add" is that "update" checks out a specific commit, rather than the tip of a branch. When you do "git submodule update" and pull all the submodules down, it doesn't check them out on a particular branch. ![]() To remedy this, run "git checkout master" before you do any work in the submodule. If I'm not working on a branch (even master), Git has trouble. It will say "Not currently on any branch." There's the problem. That made no sense because a "git pull" wouldn't give me anything new. What kind of error message is that? The part that made it confusing was that "non-fast forward" means that I'm not working at the head-basically I'm working off an older comment and trying to push that to the head. Other times, we'd get an even more frustrating error message: Just like git-submodule1, this will detach HEAD of the submodule.-overlay -no-overlay. Why was it saying things were "up-to-date"? We could do a "git log" and see the difference between the local repository and the remote repository. Adding a Submodule In our sample project, we create a new 'lib' folder to host this (and future) library code. Lets see how to work with Submodules in practice. from inside it like with any other repository. subdirectory but will leave the sub-repository in whats called a detached HEAD state. Whenever we would attempt to commit, we would get one of two messages: A Submodule remains a fully functional Git repository: you can modify files, commit, pull, push, etc. A submodule is a link to a repository within a Git repository. ![]() One small issue that we hit was when we would make changes to the code to the project in a submodule (for example, some scripting code in a submodule), we would want to commit and push those changes. Because of this, we are using Git's submodules feature. We have a number of shared projects or "common libraries" that we use between projects. We've been using Git for a little while now in a Windows environment and we have been quite pleased with it and the capabilities it affords us as part with its decentralized workflow. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |