Commit graph

38 commits

Author SHA1 Message Date
kdergachev b450b36036
Added edit/remove functionality to git-ignore (#1258)
* Added edit/remove functionality to git-ignore.

* Minor change to array-string assignment.

* Fixes array handling for remove.

* Suggested fixes (iteration over arguments, pattern removal, editor handling, tmp file location, symlinked gitignore handling).

* Changed pure bash editing of files to an awk script. Some other minor cosmetic changes.

* Updated docs.

* Modified autocomplete to work with new git-ignore

* Added help message to git-ignore.

* Added help flags to git-ignore's man.

* Made $file in eval safe. Should not do the same for editor since then all of the GIT_EDITOR will be treated as command (flags included).

* Typo fixes.
2026-07-14 19:42:02 +08:00
Edwin Kofler 3ddc315a76
Format comparisons, functions, and redirections to be consistent (#1201)
* Format comparisons and functions to be consistent

* Add `checkstyle.py` script and add check to CI

* Fix Ruff lints
2025-06-06 11:10:50 +08:00
Edwin Kofler 0b5d2cce55
Improve git-ignore command (#1047)
* Improve `git-ignore` command

* fix: Improve warnings/errors and modify `not_need_git_repo`
2023-07-13 14:29:39 +08:00
spacewander 678a0c2e71 git-ignore: the directory of target file may not exist
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
2022-04-08 21:08:29 +08:00
罗泽轩 b772251074
Merge pull request #949 from tfendin/git-ignore-ensure-newline 2022-01-03 21:24:34 +08:00
tfendin fff5fde917
Clarified comment of when newline should be added
Co-authored-by: 罗泽轩 <spacewanderlzx@gmail.com>
2021-12-30 12:47:29 +01:00
Tobias Fendin 11640196b2 git-ignore: ensure new patterns comes after a newline 2021-12-29 15:07:19 +01:00
Tobias Fendin 6b0ef19caf Fixed bug in git-ignore which ignored config core.excludeFiles 2021-12-29 14:33:28 +01:00
spacewander 458727bafb fix(git-ignore): use $XDG_CONFIG_HOME only when it is defined 2021-03-25 11:31:11 +08:00
equt ef13ed06a3
[ fix ] Quote env var 2020-11-11 22:30:10 +08:00
equt 8ed7da3f02
[ feat ] Use default global ignore file 2020-11-11 22:30:10 +08:00
Christophe Badoit 41ebe0e0bf git-ignore: support non-default .git directory
useful for submodules.

Closes tj/git-extras#807
2019-12-06 17:23:19 +01:00
Robin von Bülow 256044c04f
Use GIT_DIR environment variable to to set .git directory 2019-10-02 12:42:14 +02:00
Richard Russon f30005acfd optimisation of mkdir 2018-05-25 11:16:14 +01:00
Richard Russon 691d640b2d Ensure info dir exists 2018-05-25 10:12:27 +01:00
Richard Russon 0f76863d9b add: git-ignore -p (private to repo) 2018-05-23 23:59:21 +01:00
Jan Schulz b4f4dd1197 Add more info how to set global gitignore 2015-10-22 11:28:17 +02:00
Rob Kennedy e2b6eaf028 Don't treat ignored patterns as regexps
Fixes #353.
2015-04-29 22:48:16 -07:00
Kylie McClain 5b1ac3ccc6 use argument separator for usages of grep which can choke on weird input 2015-04-08 18:51:30 -04:00
CJ 522213a28f Support ~ in add_patterns for git-ignore 2015-03-11 15:00:30 +08:00
CJ bf89063212 Support ~ in show git-ignore 2015-03-11 15:00:24 +08:00
wooorm 1199186652 Fix typo in in git ignore message 2015-01-23 11:58:38 +01:00
spacewander 0374044790 modify the behavior of git-ignore, now it will cd root to find .gitignore 2014-11-17 21:36:56 +08:00
Konstantin Schukraft e4290dfb32 invoke bash via /usr/bin/env for portability 2014-07-02 09:41:37 +02:00
nickl- c749fdc54f Complete git-ignore includes global.
Did a rebase merge from the old pull request #46 which we may close now.
Yet it wasn't as simple as that in the end but all things have a resolve:
Added 2 context type arguments to specify --local or --global.
Refactored usage into functions te prevent duplication.
Capable to view and append to both global gitignore as well as the .gitignore from the working folder.
Supports all types of ignore patters including ! negated, comments as well as blank lines.
Complete documentation including several examples.
2012-07-22 22:27:37 +02:00
TweeKane aa084d9b7b Add global gitignore to git-ignore output 2012-07-22 22:27:37 +02:00
nickl- 7398d10bd4 Fix #127 git-ignore won't add duplicates.
As per the bug identified in #127 git-ignore would add duplicate entries in .gitignore which is redundant and should not happen.
grep will suitably verify that the entry doesn't exit but only if the file actually exists or we will get an error on stderr. check if the
file exists with test -f and that the new entry is present or alternatively just go ahead and add the new value which will create the file if it didn't exist.
Running the same command again does not add the duplicate.
2012-07-21 13:34:35 +02:00
Tj Holowaychuk b7222ed26e revert git-ignore but retain argc == 0 as showing .gitignore contents 2011-05-20 07:37:04 -07:00
Jonhnny Weslley 5117150a84 fixed typo error
Signed-off-by: Tj Holowaychuk <tj@vision-media.ca>
2011-05-19 14:26:47 -07:00
Jonhnny Weslley 954f3d5f45 git-ignore: show all availables templates if no patterns are found.
Signed-off-by: Tj Holowaychuk <tj@vision-media.ca>
2011-05-19 14:26:46 -07:00
Jonhnny Weslley e28c359a7a improved user feedback: show matched string using 'grep --color'
Signed-off-by: Tj Holowaychuk <tj@vision-media.ca>
2011-05-19 14:26:46 -07:00
Jonhnny Weslley 89e2047442 Fixes multiple matches selection
Signed-off-by: Tj Holowaychuk <tj@vision-media.ca>
2011-05-19 14:26:46 -07:00
Jonhnny Weslley a5392d54c3 git-ignore template support. Templates are based in https://github.com/github/gitignore
Signed-off-by: Tj Holowaychuk <tj@vision-media.ca>
2011-05-19 14:26:46 -07:00
Jonhnny Weslley 38d8a22589 git-ignore doesnt fail if .gitignore file dont exists yet
Signed-off-by: Tj Holowaychuk <tj@vision-media.ca>
2011-05-19 14:26:46 -07:00
Jonhnny Weslley 81ede0a4ba show ignored files if no arguments are provided 2010-10-08 08:29:27 -07:00
Tj Holowaychuk 4dc99404ac Added git-delete-branch 2010-08-10 21:13:59 -07:00
Tj Holowaychuk e36ef2fcb4 Docs for git-ignore. Closes #3 2010-08-05 07:41:42 -07:00
Tj Holowaychuk fc22d00bf1 Added git-ignore 2010-08-05 07:39:28 -07:00