clothessite.blogg.se

Removing git submodule
Removing git submodule











  1. #REMOVING GIT SUBMODULE HOW TO#
  2. #REMOVING GIT SUBMODULE UPDATE#
  3. #REMOVING GIT SUBMODULE WINDOWS#

#REMOVING GIT SUBMODULE UPDATE#

If you do not want (or can) update your git, then just use another machine with a newer git! git is meant to be fully distributed, so you can use another git to get the job done: If your machine is too old there is no submodule deinit in your git.

  • Perhaps there are more ways to fail I am not aware of (I am just some git power-user.).
  • (Perhaps using another machine fixes it.) Then you are on the dark side and things get ugly and complicated.
  • You have done something in the past which is unsupported by git.
  • Then first clean your submodule using that command.
  • Your submodule is not clean in a git clean sense.
  • You have uncommitted data and might lose data.
  • The commands above may fail due to following: (Hence the clever name: git) If this fails Please remember that: AFAICS git follows the technical path, not the social one. Hence what's obvious for you often is not the right thing in all possible technical situations. Reliability in each and every situation is far more important. This is because "obvious" here depends from the point of view. So I understand complaints of people, saying "Why doesn't do git the obvious thing for me". git is a tool, which must do a reliable job, instead of being just another "Eierlegende Wollmilchsau" ("Eierlegende Wollmilchsau" translates for me to "some evil version of a Swiss army knife"). This truly is puzzling to newcomers, but basically is a good thing: git just does the obviously thing and does that right, and does not even try to do more. Also "pulling in the data" is implicit, because you need it, but removing the cached information is not done, because this is not needed at all and might wipe precious data. There simply is no need for more than two commands. This cannot be fully symmetric, as keeping it strictly symmetric does not make much sense.

    removing git submodule

    (3) checks out the submodules of the submodule recursively.git submodule update -init -recursive - module.(2) does git submodule update, so, nonrecursively checks out the module.

    removing git submodule

    (1) does git submodule init, so updates.(3) thereby recursively removes the submodules of the submodule.Git submodule update -init -recursive - moduleīecause some commands basically need to do more than just a single thing:

    removing git submodule

    In my understanding this is not only plain wrong, it is extremely dangerous and provokes major headaches in future! See below.Īlso is quite the inverse to git submodule add - URL module It recommends to remove $GIT_DIR/modules// yourself. I think there is a very dangerous part in the documentation of git submodule. Like a proper way to remove submodules again. Stay away at all cost!Īnd yes, you can blame git for this, as many handy things were missing in git in the past.

    #REMOVING GIT SUBMODULE WINDOWS#

  • If on Windows ignore the first line and replace "$submodule" with the Windows way of a properly specified path to the submodule.
  • "$submodule" is just to emphasize where to put the name, and that you have to be careful with spaces and the like.
  • If this does not work for you, see below.
  • Following is the tested and safe way for git version 2.17 and above to get rid of a submodule: submodule="path/to/sub" # no trailing slash!

    #REMOVING GIT SUBMODULE HOW TO#

    This is regardless of whether you do steps 2 or 3.įor the benefit of the reader, this here tries to sum it up and give a step-by-step guide on how to do it if things do not work as expected. Last but not least, if you don't git commit, you will/may get an error when doing git submodule summary (as of git 2.7): fatal: Not a git repository: 'the_submodule/.git' Submodule from the repository and commit that use git-rm According to the git-submodule documentation, git deinit: I find it more explicit and less confusing to use git config -f. (The entry may cause problems for older git versions, but I don't have one to test).įor this, most answers suggest using git submodule deinit. Step 3 removes the section for the_submodule in the file.

    removing git submodule

    You can probably get away with the above two steps for git 1.8.5+ as tinlyx's answer noted, as all git submodule commands seem to work. git/modules/ for otherwise, you can't e.g. Hopefully, the second part of OP question can be answered positively one day (that this can be done in one command).īut as of July 2017, step 2 is necessary to remove data in. In theory, git rm in step 1 should take care of it. git/config -remove-section submodule.the_submodule Here are the 4 steps that I found necessary or useful (important ones first): git rm -f the_submodule













    Removing git submodule