Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. ### Detached Head
  2. - If ended up with a detached HEAD, it can be pushed to a remote
  3. repository (without the need to creating a new local branch) by the following command:
  4.  
  5. ```bash
  6. git push <remote name> HEAD:<remote branch name>
  7. ```
  8. E.g.
  9. ```bash
  10. git push origin HEAD:master
  11. ```
  12. ----
  13. ### Un-submodule a submodule
  14. - NOTE: You will lose your submodule’s git history if you follow this solution!
  15. If you value the submodule history and won’t accept this compromise, do not follow these instructions!
  16.  
  17. 1. Move the files and deinit the submodule
  18. ```bash
  19. mv yoursubmodule yoursubmodule_tmp
  20. git submodule deinit yourSubmodule
  21. git rm --cached yourSubmodule
  22. mv yoursubmodule_tmp yoursubmodule
  23. git add yoursubmodule
  24. ```
  25.  
  26. 2. Git submodules metadata is stored in the .gitmodules file as shown below.
  27. Remove the submodule from that file:
  28. ```bash
  29. [submodule "yoursubmodule"]
  30. path = path/to/yoursubmodule
  31. url = git@github.com/exampleUser/models
  32. ```
  33. 3. .git/config has a similar entry, remove the submodule from that as well.
  34.  
  35. 4. Cleanup the .git/modules directory
  36. ```bash
  37. rm -rf .git/modules/yoursubmodule
  38. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement