Skip to content

Easily move submodules within a git repository (shell script)

License

Notifications You must be signed in to change notification settings

xwmx/git-submodule-move

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Git helper shell-script to move submodules within the super-repository

Usage: git-submodule-move [-v|--verbose] path/to/submodule new/path/

Example:

git-submodule-move --verbose path/to/submodule new/path/
 updating super-repository's submodule name
 updating super-repository's submodule path
 updating super-repository's submodule repository config
 updating submodule's pointer to super-repository config
 moving super-repository's submodule repository
 moving submodule directory
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#	modified:   .gitmodules
#	renamed:    path/to/submodule -> /new/path/submodule
#
Please inspect the changes and if satisfied commit the change

The directory layout changes thus:

before: ./path/to/submodule
after:  ./new/path/submodule

Confirm the changes are acceptable (git status) then COMMIT them

To revert a submodule move before commiting it simply reverse the arguments. E.g.

git-submodule-move path/to/submodule new/path/
...
# On branch master
# Changes to be committed:
#  (use "git reset HEAD <file>..." to unstage)
#
#	modified:   .gitmodules
#	renamed:    path/to/submodule -> new/path/submodule
#

git-submodule-move new/path/submodule path/to/
...
# On branch master
nothing to commit, working directory clean
Please inspect the changes and if satisfied commit the change

The script can move submodules that use local (path) and external (protocol, e.g. git://) URLs in the .gitmodules file

About

Easily move submodules within a git repository (shell script)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%