From 5ccc3b5edb05ea24ea1dadb9aa5c1c83dce53b95 Mon Sep 17 00:00:00 2001 From: Robofish <1683502971@qq.com> Date: Wed, 13 Nov 2024 00:06:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0gitignore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/README.md b/README.md index bfb3414..d0173fc 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ 为了更好地使用 Git,下面是一篇通过 VS Code 使用 Git 的教程(基础操作,仅包含创建和提交)。 关于如何配置 SSH 请参考文章:[如何配置 SSH](https://qutcmrt.top/index.php/archives/195/) + ## 第一步:安装 Git 插件 在扩展里搜索 Git,安装以下三个插件: @@ -52,3 +53,81 @@ git push -u origin main 成功创建远程仓库!之后进入 Gitea 即可分享和下载代码。 ![成功创建](https://qutcmrt.top/usr/uploads/2024/11/4003579224.png) + +## 使用 .gitignore 节约服务器资源 + +为了节约服务器资源,请在上传时使用 `.gitignore` 文件,将编译文件等不要上传。 + +### .gitignore 规范 + +这里我们列举出比较重要的几种规范,如下所示: + +- `#`:`#` 开头的为注释内容 +- 正则表达式:可以使用正则表达式来进行模式匹配,默认会递归循环整个目录 +- `*` : 匹配单个或多个字符 +- `**` : 匹配多级目录 +- `?` : 匹配单个字符 +- `[abc]` : 匹配 a、b、c 中的任意一个字符 +- `[a-c]` : 匹配 a~c 之间的任意一个字符 +- `/` 开头:只在当前目录匹配,不进行递归,比如 `/src` 表示只匹配当前目录的 src 文件或目录,不去其他目录匹配 +- `/` 结尾:只匹配目录,不匹配文件,比如 `target/` 表示只匹配 target 目录,不匹配 target 文件 +- `!` 开头: 取反,不匹配指定的文件或目录,比如 `!main.xml` 表示不排除所有的 main.xml 文件 + +### 举例 + +```gitignore +# ---> ROS +devel/ +logs/ +build/ +bin/ +lib/ +msg_gen/ +srv_gen/ +msg/*Action.msg +msg/*ActionFeedback.msg +msg/*ActionGoal.msg +msg/*ActionResult.msg +msg/*Feedback.msg +msg/*Goal.msg +msg/*Result.msg +msg/_*.py +build_isolated/ +devel_isolated/ + +# Generated by dynamic reconfigure +*.cfgc +/cfg/cpp/ +/cfg/*.py + +# Ignore generated docs +*.dox +*.wikidoc + +# eclipse stuff +.project +.cproject + +# qcreator stuff +CMakeLists.txt.user + +srv/_*.py +*.pcd +*.pyc +qtcreator-* +*.user + +/planning/cfg +/planning/docs +/planning/src + +*~ + +# Emacs +.#* + +# Catkin custom files +CATKIN_IGNORE + +.catkin_workspace +``` \ No newline at end of file