29

Matryoshka, a bash script for making git submodules management less hassle

 5 years ago
source link: https://www.tuicool.com/articles/hit/FnAjYfr
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

EZ3aIjn.png!web

Matryoshka

Managing Git submodules is monotonous and — more importantly — interruptive work. Managing your dependencies shouldn't keep you from being productive. This script will automate the part of updating your submodules for you.

Disclaimer: Use at your own risk. I cannot be held responsible for data loss.

If you encounter any trouble though, please let me know

Installation & Setup

matryoshka
$ chmod +x *.sh
  1. Assure your Git submodules are setup properly and these commands have been run at least once since adding your latest modules:
git submodule init
git submodule update
  1. Optional: I prefer to have this script ready at all times without manually typing out its path. I suggest creating an alias within your .bashrc | .zshrc :
alias MATRYOSHKA="path/to/matryoshka/matryoshka.sh"

Don't forget to reload your shell afterwards. ;)

Run

  1. Enter your repo directory and call the script sh path/to/matryoshka.sh (or use the more conveniant alias )

  2. Decide if you would just like to update all submodules and leave them unstaged and uncommitted or generate a commit for each updated submodule.

How does auto-commit work?

  1. Matryoshka checks if the working directory is dirty
"Submodule update <date>"
"Update <submodule_name> to <shortened_hash>"

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details

Support

The framework and code are provided as-is, but if you need help or have suggestions, you can contact me anytime at [email protected] .

I'd like to hear from you

If you have got any suggestions, please feel free to share them with me. :)


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK