周报@2023-05-23 @ Fri, May 26, 2023 5:13 PM
周报@2023-05-23 @ Mon, May 29, 2023 4:03 PM
Expand 2 lines ...
3
author: powerfulyang
3
author: powerfulyang
4
date: 2023-05-23
4
date: 2023-05-23
5
public: true
5
public: true
6
-
summary: "husky hooks 不生效,不起作用的解决方法。 解决 TS2451: Cannot redeclare block-scoped variable 'self' 错误。"
6
+
summary: "husky hooks 不生效,不起作用的解决方法。 解决 TS2451: Cannot redeclare block-scoped variable 'self' 错误。 Java 中使用 swagger 如何设置 operationId。 解决 nginx: [emerg] \"add_header\" directive is not allowed here 错误。 Git 排除某个文件夹,但是要将其中的某个或某些文件包含进"
7
tags:
7
tags:
8
    - 周报
8
    - 周报
9
---
9
---
Expand 56 lines ...
66
66
67
请根据你的需要修改 "Name-of-your-header" 和 "Value-of-your-header"。
67
请根据你的需要修改 "Name-of-your-header" 和 "Value-of-your-header"。
68
+
69
+
##
70
+
71
+
如果你想在 Git 中排除某个文件夹,但是要将其中的某个或某些文件包含进来,你可以在 `.gitignore` 文件中使用特殊的语法。
72
+
73
+
以下面的例子为例,假设你想要排除 `my_folder` 中的所有文件,但是想要包含 `my_folder/subfolder/my_file.txt`。首先,你需要在 `.gitignore` 文件中添加以下内容:
74
+
75
+
```bash
76
+
# Ignore everything in the directory
77
+
my_folder/*
78
+
79
+
# Exclude specific subdirectories or files
80
+
!my_folder/subfolder/
81
+
!my_folder/subfolder/my_file.txt
82
+
```
83
+
84
+
第一行命令会让 Git 忽略 `my_folder` 中的所有文件。然后,下面两行的 `!` 符号将特定的子目录和文件从忽略列表中排除。注意,我们需要显式地将整个子目录添加到例外中,因为我们之前已经忽略了整个 `my_folder` 文件夹。
85
+
86
+
你需要根据你的具体情况调整上述的路径和文件名,以满足你的需求。