add git-ignore-add function to git module
This commit is contained in:
parent
f2a826e963
commit
a948489156
2 changed files with 18 additions and 0 deletions
|
@ -231,6 +231,7 @@ Functions
|
|||
- `git-hub-shorten-url` shortens GitHub URLs.
|
||||
- `git-info` exposes repository information via the `$git_info` associative
|
||||
array.
|
||||
- `git-ignore-add` adds any passed paramaters to the root's .gitignore.
|
||||
- `git-root` displays the path to the working tree root.
|
||||
- `git-stash-clear-interactive` asks for confirmation before clearing the stash.
|
||||
- `git-stash-dropped` lists dropped stashed states.
|
||||
|
|
17
modules/git/functions/git-ignore-add
Normal file
17
modules/git/functions/git-ignore-add
Normal file
|
@ -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…
Add table
Reference in a new issue