Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

My extra github commands

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 bin
Octocat-spinner-32 README.mkdn
README.mkdn

git-in-repo

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.

Usage

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

git-subdirs

Run a single git command in all subdirectories

Usage

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

git subdirs COMMAND

Same, but with write permissions.

git subdirs --allow-write COMMAND

Description

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.

git-forest

This was not originally written by me. The original is from http://jengelh.medozas.de/projects/hxtools/. I made some minor modifications to it. You'll have to diff it with the original to see.

git-have-commits

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

git-myinit

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.

Something went wrong with that request. Please try again.