Compare commits

..

No commits in common. "07d5cbd029108263573d66d504e379a86835bef9" and "dbda7e15b0d9d45db55f3b90510e4181e7388fa6" have entirely different histories.

2 changed files with 3 additions and 71 deletions

View File

@ -1,6 +1,6 @@
## 2.7 Git Basic Ops
### 2.7.1 git tag
## 2.7.1 git tag
给当前的进度打个标签
```bash
@ -8,7 +8,7 @@ git tag -m "some message" <version-string>
git describe # 查看标签
```
### 2.7.2 Git 删除文件
## 2.7.2 Git 删除文件
git
```bash
@ -26,71 +26,3 @@ git ls-files --with-tree=HEAD^ # 父节点中的文件还在
git add -u #将版本库中的本地文件的变更记录到暂存区中
```
### 2.7.3 恢复删除的文件
```bash
git cat-file -p HEAD~1:filename > filename
```
### 2.7.4 移动文件
```bash
git mv welcome.txt README # git提供的git mv来移动文件
git commit -m "rename test" # 在输出的结果中可以查看改名前后两个文件的相似度
```
### 2.7.5 显示版本号
```bash
git describe # 展示版本号
```
```bash
git log --oneline --decorate -4 #在提交日志中显示提交对应的Tag
```
### 2.7.6 git add -i
```bash
git add -i #进入一个交互式的提交脚本
```
### 2.7.8 Git忽略
就是编辑.gitignore文件
可以设置全局忽略的文件位置
```bash
git config --global core.excludesfile /path/to/file
git config core.excludesfile
```
小trick,可以用cat快速写入一个文件
```bash
cat > .gitignore << EOF
hello
*.o
*.h
EOF
```
忽略语法
```text
# 这是注释行 —— 被忽略
*.a # 忽略所有以 .a 为扩展名的文件。
!lib.a # 但是 lib.a 文件或者目录不要忽略,即使前面设置了对 *.a 的忽略。
/TODO # 只忽略根目录下的 TODO 文件,子目录的 TODO 文件不忽略。
build/ # 忽略所有 build/ 目录下的文件。
doc/*.txt # 忽略文件如 doc/notes.txt但是文件如 doc/server/arch.txt 不被忽略。
```
### 2.7.9 Git Archive
```bash
git archive -o latest.zip HEAD # 根据最新的提交创建zip
git archive -o latest.zip HEAD src doc # 只将目录src doc放入zip中
git archive --format=tar --prefix=1.0/ v1.0 | gzip > foo-1.0.tar.gz
```

View File

@ -1,6 +1,6 @@
#ifndef HELLO_WORLD_VERSION_H
#define HELLO_WORLD_VERSION_H
#define _VERSION "<version>"
#define _VERSION "old_practise"
#endif