File: git-delete-submodule

package info (click to toggle)
git-extras 1.7.0-1.2
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 696 kB
  • sloc: sh: 381; makefile: 52
file content (13 lines) | stat: -rwxr-xr-x 442 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/bash

submodule=$1

test -z $submodule && echo "submodule required" 1>&2 && exit 1
test ! -f .gitmodules && echo ".gitmodules file not found" 1>&2 && exit 2

NAME=$(echo $submodule | sed 's/\/$//g')
test -z $(git config --file=.gitmodules submodule.$NAME.url) && echo "submodule not found" 1>&2 && exit 3

git config --remove-section submodule.$NAME
git config --file=.gitmodules --remove-section submodule.$NAME
git rm --cached $NAME