My extra github commands
Perl Shell
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



Determine if the current directory is in a git repository. Returns true if so, false otherwise. This is mostly for use in other scripts, so that they can abort if run outside a git repo.


if git in-repo; then
  git status
  echo "Not in a git repository"


Run a single git command in all subdirectories


Run a git command in each subdirectory of the current directory:

git subdirs COMMAND

Same, but with write permissions.

git subdirs --allow-write COMMAND


This command will run git COMMAND in each subdirectory of the current directory if that subdirectory is a git repository, By default, it uses unionfs-fuse to run git in a read-only view of the repository. This allows you to run commands to query the status of each repository such as status and log without risk of accidentally damaging many repositories at once with a command like branch -D master.

If unionfs-fuse is unavailable, read-only mode is disabled.

You can use the --allow-write option to run a command that modifies the repositories. I recommend that you think carefully before using this option.

If the current directory is inside a git repository, this command will do nothing, and suggest that you simply run git COMMAND instead.


This was not originally written by me. The original is from I made some minor modifications to it. You'll have to diff it with the original to see.


Returns true if the current directory is inside a git repository and that repository has at least one commit.


Equivalent to

git init && touch .gitignore && git commit .gitignore -m "Initial commit"

except that if the repository already has a commit in it, it just does git init.