Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Detached Head
- - If ended up with a detached HEAD, it can be pushed to a remote
- repository (without the need to creating a new local branch) by the following command:
- ```bash
- git push <remote name> HEAD:<remote branch name>
- ```
- E.g.
- ```bash
- git push origin HEAD:master
- ```
- ----
- ### Un-submodule a submodule
- - NOTE: You will lose your submodule’s git history if you follow this solution!
- If you value the submodule history and won’t accept this compromise, do not follow these instructions!
- 1. Move the files and deinit the submodule
- ```bash
- mv yoursubmodule yoursubmodule_tmp
- git submodule deinit yourSubmodule
- git rm --cached yourSubmodule
- mv yoursubmodule_tmp yoursubmodule
- git add yoursubmodule
- ```
- 2. Git submodules metadata is stored in the .gitmodules file as shown below.
- Remove the submodule from that file:
- ```bash
- [submodule "yoursubmodule"]
- path = path/to/yoursubmodule
- url = git@github.com/exampleUser/models
- ```
- 3. .git/config has a similar entry, remove the submodule from that as well.
- 4. Cleanup the .git/modules directory
- ```bash
- rm -rf .git/modules/yoursubmodule
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement