Last active
October 28, 2016 19:53
-
-
Save sloanlance/c5835ac2b60d3d7f3d4f197de528d3f9 to your computer and use it in GitHub Desktop.
git: A git extension to add a filename to the local repository's `exclude` file.
This file contains hidden or 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
#!/bin/sh -- | |
# Save as "git-exclude" and set the executable flag. | |
# Execute as "git exclude repo_path file_path" | |
if [ $# -ne 2 ]; then | |
echo "usage: $(basename $0 | sed 's/-/ /g') <repo-dir> <file-path>" > /dev/stderr | |
exit $(false) | |
fi | |
fullfilepath="${1}/${2}" | |
if [ ! -f "${fullfilepath}" ]; then | |
echo "File \"${2}\" not found in repo \"${1}\"." > /dev/stderr | |
exit $(false) | |
fi | |
echo "${2}" >> "${1}/.git/info/exclude" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment