Created
May 20, 2018 20:00
-
-
Save bavis-m/102224151e860fedfe9a6806935b84eb to your computer and use it in GitHub Desktop.
bash function for pushd-ing the directory of the Nth submodule in a git project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
pushmod() { | |
local root=`git rev-parse --show-toplevel` | |
local dir=`git config --file "$root/.gitmodules" --get-regexp path | cut -d" " -f2- | sed "\\\$q;${1:-1}q;d"` | |
pushd "$root/$dir" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment