Compare commits
8 Commits
4bdf9b82bc
...
hello_1.0
Author | SHA1 | Date | |
---|---|---|---|
dbda7e15b0 | |||
4e8d0b6f8c | |||
11474a652c | |||
756beab203 | |||
711087a041 | |||
cb4892dd9f | |||
e073cddd87 | |||
d68790956e |
1
hack-1.txt
Normal file
1
hack-1.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
hello.
|
34
notes/2.6-git_stash.md
Normal file
34
notes/2.6-git_stash.md
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
## 2.6
|
||||||
|
|
||||||
|
### 2.6.1
|
||||||
|
|
||||||
|
用来查看stash列表
|
||||||
|
```bash
|
||||||
|
git stash list
|
||||||
|
```
|
||||||
|
|
||||||
|
恢复进度
|
||||||
|
```bash
|
||||||
|
git stash pop
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git commit -m "message" # 执行提交
|
||||||
|
git status -s # 查看状态
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git reset --soft HEAD^ #反悔提交 将HEAD指向当前提交的父提交
|
||||||
|
git reset HEAD a/b/c # 将a/b/c目录下的文件撤出暂存区
|
||||||
|
git reset 将所有的文件从stage中撤出
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git checkout -- welcome.txt # 清除welcome.txt的改动
|
||||||
|
git clean -nd # 删除本地多余的目录和文件列表
|
||||||
|
git clean -fd # 真正删除
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
28
notes/2.7-git_basic_op.md
Normal file
28
notes/2.7-git_basic_op.md
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
## 2.7 Git Basic Ops
|
||||||
|
|
||||||
|
## 2.7.1 git tag
|
||||||
|
|
||||||
|
给当前的进度打个标签
|
||||||
|
```bash
|
||||||
|
git tag -m "some message" <version-string>
|
||||||
|
git describe # 查看标签
|
||||||
|
```
|
||||||
|
|
||||||
|
## 2.7.2 Git 删除文件
|
||||||
|
git
|
||||||
|
|
||||||
|
```bash
|
||||||
|
rm *.txt
|
||||||
|
git ls-files #本地删除不是真的删除,暂存库中还在,也就是删除的这个命令没有被添加到暂存库中
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git rm welcome.txt hack-2.txt #将文本文件从git中删除
|
||||||
|
git status
|
||||||
|
git ls-files --with-tree=HEAD^ # 父节点中的文件还在
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git add -u #将版本库中的本地文件的变更记录到暂存区中
|
||||||
|
```
|
||||||
|
|
27
src/Makefile
Normal file
27
src/Makefile
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
OBJECTS = main.o
|
||||||
|
TARGET = hello
|
||||||
|
|
||||||
|
all: $(TARGET)
|
||||||
|
|
||||||
|
$(TARGET): $(OBJECTS)
|
||||||
|
$(CC) -o $@ $^
|
||||||
|
|
||||||
|
main.o: | new_header
|
||||||
|
main.o: version.h
|
||||||
|
|
||||||
|
new_header:
|
||||||
|
@sed -e "s/<version>/$$(git describe)/g" \
|
||||||
|
<version.h.in> version.h.tmp
|
||||||
|
@if diff -q version.h.tmp version.h > /dev/null 2>&1; \
|
||||||
|
then \
|
||||||
|
rm version.h.tmp; \
|
||||||
|
else \
|
||||||
|
echo "version.h.in => version.h" ; \
|
||||||
|
mv version.h.tmp version.h;\
|
||||||
|
fi
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(TARGET) $(OBJECTS) version.h
|
||||||
|
|
||||||
|
.PHONY: all clean
|
||||||
|
|
8
src/main.c
Normal file
8
src/main.c
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#include "version.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
printf("Hello, world. \n");
|
||||||
|
printf("version: %s. \n", _VERSION);
|
||||||
|
return 0;
|
||||||
|
}
|
6
src/version.h
Normal file
6
src/version.h
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#ifndef HELLO_WORLD_VERSION_H
|
||||||
|
#define HELLO_WORLD_VERSION_H
|
||||||
|
|
||||||
|
#define _VERSION "old_practise"
|
||||||
|
|
||||||
|
#endif
|
Reference in New Issue
Block a user