差别
这里会显示出您选择的修订版和当前版本之间的差别。
两侧同时换到之前的修订记录 前一修订版 后一修订版 | 前一修订版 | ||
public:it:git [2021/11/01 16:59] – [Tips] oakfire | public:it:git [2024/05/09 14:34] (当前版本) – [Tips] oakfire | ||
---|---|---|---|
行 38: | 行 38: | ||
* 简单概括:**父项目只记录子模块的commit id**, | * 简单概括:**父项目只记录子模块的commit id**, | ||
* 新增Submodule:< | * 新增Submodule:< | ||
- | git submodule add [repository 位置] [欲放置的位置] # 增加一個新的 submodule | + | git submodule add <repository 位置> <欲放置的位置> # 增加一個新的 submodule |
- | git add .gitmodules | + | git add .gitmodules |
git commit -m "Add submodule into version control" | git commit -m "Add submodule into version control" | ||
git submodule init # 初始化.git/ | git submodule init # 初始化.git/ | ||
行 54: | 行 54: | ||
git submodule init | git submodule init | ||
git submodule update | git submodule update | ||
- | git submodule update --recursive | + | # 或一条命令循环初始化及更新子模块 |
+ | git submodule update --init --recursive | ||
</ | </ | ||
* 修改Submodule的内容: | * 修改Submodule的内容: | ||
行 68: | 行 69: | ||
* 移除Submodule:< | * 移除Submodule:< | ||
# 先砍掉目录 | # 先砍掉目录 | ||
- | git rm --cached | + | git rm --cached |
- | rm -rf [欲移除的目錄] | + | rm -rf <欲移除的目录> |
# 修改 .gitmodules,将相关内容移除 | # 修改 .gitmodules,将相关内容移除 | ||
vim .gitmodules | vim .gitmodules | ||
行 103: | 行 104: | ||
* 增加远程仓库< | * 增加远程仓库< | ||
* 选择远程仓库push <code bash> git push [repo_name] [branch]</ | * 选择远程仓库push <code bash> git push [repo_name] [branch]</ | ||
+ | * 删除远程仓库分支:< | ||
+ | * 删除本地的远程分支追踪(比如在远程分支删除后本地'' | ||
* 打tag最好用-a -m , | * 打tag最好用-a -m , | ||
* 删除远程仓库tag< | * 删除远程仓库tag< | ||
行 113: | 行 116: | ||
# tag << | # tag << | ||
# Pushing an empty <src> allows you to delete the <dst> ref from the remote repository.</ | # Pushing an empty <src> allows you to delete the <dst> ref from the remote repository.</ | ||
- | * 删除本地的远程分支追踪(比如在远程分支删除后本地'' | ||
* merge 分支后, 如果隐藏了分支的 commit 信息, 具体查看可以使用< | * merge 分支后, 如果隐藏了分支的 commit 信息, 具体查看可以使用< | ||
* 撤销 '' | * 撤销 '' | ||
行 122: | 行 124: | ||
* 合并特定的单个commit, | * 合并特定的单个commit, | ||
* 凭证存储: | * 凭证存储: | ||
- | * :!:如果设为store模式,将在本地明文存储用户密码 | + | * 如果设为store模式,将在本地明文存储用户密码, |
* 打印更多日志:< | * 打印更多日志:< | ||
* 提交空commit: <code bash>git commit --allow-empty -m " | * 提交空commit: <code bash>git commit --allow-empty -m " | ||
* 修改上一次commit的message: | * 修改上一次commit的message: | ||
- | * 保存用户名和密码, | + | * 设置 vim 为默认编辑器: |
+ | * 删除某文件的所有历史记录,[[https: | ||
+ | * 查找大文件:'' | ||
+ | * 从历史记录删除:'' | ||
+ | * 显示差异时忽略行尾空格差异: <code bash>git diff --ignore-space-at-eol</ | ||
==== server: gitolite ==== | ==== server: gitolite ==== | ||
* [[http:// | * [[http:// | ||
行 137: | 行 144: | ||
但对使用者来说, | 但对使用者来说, | ||
考虑找个或弄个简化版的本地版本控制系统, | 考虑找个或弄个简化版的本地版本控制系统, | ||
+ | 这篇文章不错:https:// | ||
</ | </ | ||