1
0
Fork 0

add git-ignore-add function to git module

pull/1009/head
Matt Hamilton 9 years ago
parent f2a826e963
commit a948489156

@ -231,6 +231,7 @@ Functions
- `git-hub-shorten-url` shortens GitHub URLs. - `git-hub-shorten-url` shortens GitHub URLs.
- `git-info` exposes repository information via the `$git_info` associative - `git-info` exposes repository information via the `$git_info` associative
array. array.
- `git-ignore-add` adds any passed paramaters to the root's .gitignore.
- `git-root` displays the path to the working tree root. - `git-root` displays the path to the working tree root.
- `git-stash-clear-interactive` asks for confirmation before clearing the stash. - `git-stash-clear-interactive` asks for confirmation before clearing the stash.
- `git-stash-dropped` lists dropped stashed states. - `git-stash-dropped` lists dropped stashed states.

@ -0,0 +1,17 @@
#
# Adds files passed as parameters to .gitignore in project root
#
# Authors:
# Matt Hamilton <m@tthamilton.com>
#
# make sure we have a git-root
if ! git-root &> /dev/null; then
print 'not in a git repository' >&2
return 1
fi
# we are in a git repository. add parameters to .gitignore
for file in "$@" do
print "$file" >>! $(git-root)/.gitignore
done
Loading…
Cancel
Save