diff mbox series

[RFC] gitignore: allow gitignore to ignore most dot file

Message ID IA1PR20MB495312A830387CB43CF96A60BB07A@IA1PR20MB4953.namprd20.prod.outlook.com
State Superseded
Headers show
Series [RFC] gitignore: allow gitignore to ignore most dot file | expand

Commit Message

Inochi Amaoto July 29, 2023, 9:47 a.m. UTC
Nowdays, most of the editor use files or directories begin with dot to
store some settings. So let git ignore these files and directories to
reduce potential mistakes.

Add dot match to ignore any editor file and there are two exceptions:
- .gitignore
- .clang-format

Signed-off-by: Inochi Amaoto <inochiama@outlook.com>
---
Note:
1. AFAIK, the vim swap file is also begin with dot.
2. the patch also covers the patch `gitignore: add VSCode workspace dir`
so that patch is not needed anymore.
---
 .gitignore | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

--
2.41.0

Comments

Bin Meng July 31, 2023, 1:20 a.m. UTC | #1
On Sat, Jul 29, 2023 at 5:49 PM Inochi Amaoto <inochiama@outlook.com> wrote:
>
> Nowdays, most of the editor use files or directories begin with dot to

typo: Nowadays

> store some settings. So let git ignore these files and directories to
> reduce potential mistakes.
>
> Add dot match to ignore any editor file and there are two exceptions:
> - .gitignore
> - .clang-format
>
> Signed-off-by: Inochi Amaoto <inochiama@outlook.com>
> ---
> Note:
> 1. AFAIK, the vim swap file is also begin with dot.
> 2. the patch also covers the patch `gitignore: add VSCode workspace dir`
> so that patch is not needed anymore.
> ---
>  .gitignore | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
diff mbox series

Patch

diff --git a/.gitignore b/.gitignore
index c11afd3..fbba52e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,10 @@ 
+# ignore anything begin with dot
+.*
+
+# exceptions we need even begin with dot
+!.clang-format
+!.gitignore
+
 # Object files
 *.o
 *.a
@@ -10,4 +17,3 @@  install/
 # Development friendly files
 tags
 cscope*
-*.swp