{"id":1779,"date":"2017-11-07T13:46:37","date_gmt":"2017-11-07T12:46:37","guid":{"rendered":"http:\/\/www.edy.es\/dev\/?page_id=1779"},"modified":"2024-02-12T16:14:55","modified_gmt":"2024-02-12T15:14:55","slug":"git-advanced-cookbook","status":"publish","type":"page","link":"https:\/\/www.edy.es\/dev\/docs\/git-advanced-cookbook\/","title":{"rendered":"GIT Advanced Cookbook"},"content":{"rendered":"<p>A collection of GIT specialized tasks that require diving into Stack Overflow for getting the correct answers.<\/p>\n<h3>Changing remote repository for a git submodule<\/h3>\n<pre># Edit the .gitmodules file to update the URL\r\ngit submodule sync<\/pre>\n<p><a href=\"https:\/\/stackoverflow.com\/a\/914090\">https:\/\/stackoverflow.com\/a\/914090<\/a><\/p>\n<h3>How do I move an existing Git submodule within a Git repository?<\/h3>\n<pre>git mv old\/submod new\/submod<\/pre>\n<p>git 1.9.3+<br \/>\n<a href=\"https:\/\/stackoverflow.com\/a\/24767348\">https:\/\/stackoverflow.com\/a\/24767348<\/a><\/p>\n<p><strong>Note:<\/strong> Always use git bash \/ mingw32. Do NOT use git from Windows&#8217; command line.<\/p>\n<h3>How do I remove a submodule?<\/h3>\n<pre>git submodule deinit -f path\/to\/submodule                   # Remove the entry from .git\/config\r\nrm -rf .git\/modules\/path\/to\/submodule                       # Remove the directory from .git\/modules\/\r\ngit rm -f path\/to\/submodule                                 # Remove the entry in .gitmodules and the submodule directory<\/pre>\n<p>git 1.7.8+<br \/>\n<a href=\"https:\/\/stackoverflow.com\/a\/36593218\">https:\/\/stackoverflow.com\/a\/36593218<\/a><\/p>\n<h3>How to update a superproject\u00a0where submodules have changed in remote and\/or local\u00a0folder<\/h3>\n<p>First, check out the latest state at the superproject. It should contain an updated .gitmodule file. Then:<\/p>\n<pre>git submodule sync                                          # Propagate the changes from the .gitmodule file\r\ngit submodule update                                        # Check out the proper commits from the submodules\r\ngit reset --all                                             # Remove old submodule folders<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A collection of GIT specialized tasks that require diving into Stack Overflow for getting the correct answers. Changing remote repository for a git submodule # Edit the .gitmodules file to update the URL git submodule sync https:\/\/stackoverflow.com\/a\/914090 How do I move an existing Git submodule within a Git repository? git mv old\/submod new\/submod git 1.9.3+ [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1780,"parent":228,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"page-c.php","meta":{"jetpack_post_was_ever_published":false,"footnotes":""},"class_list":["post-1779","page","type-page","status-publish","has-post-thumbnail","hentry"],"jetpack_shortlink":"https:\/\/wp.me\/P1PjRF-sH","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.edy.es\/dev\/wp-json\/wp\/v2\/pages\/1779","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.edy.es\/dev\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.edy.es\/dev\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.edy.es\/dev\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.edy.es\/dev\/wp-json\/wp\/v2\/comments?post=1779"}],"version-history":[{"count":11,"href":"https:\/\/www.edy.es\/dev\/wp-json\/wp\/v2\/pages\/1779\/revisions"}],"predecessor-version":[{"id":1882,"href":"https:\/\/www.edy.es\/dev\/wp-json\/wp\/v2\/pages\/1779\/revisions\/1882"}],"up":[{"embeddable":true,"href":"https:\/\/www.edy.es\/dev\/wp-json\/wp\/v2\/pages\/228"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.edy.es\/dev\/wp-json\/wp\/v2\/media\/1780"}],"wp:attachment":[{"href":"https:\/\/www.edy.es\/dev\/wp-json\/wp\/v2\/media?parent=1779"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}