-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgit.cheat
47 lines (33 loc) · 979 Bytes
/
git.cheat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
% git
# 追踪文件之树
git ls-tree -r main --name-only | tree -Ca --fromfile
# 清理缓存,以便重新建立忽略规则
git rm -r --cached .
# 深层墓场
git reflog
# 交互式清理未跟踪文件与忽略文件
git clean -fxi
# 历次提交的文件变化
git log --stat
# 历次提交的详细变化情况
git log --stat -p -W <path>
# 查看某次提交的内容
git show <opt-name-only> <commit>
$ opt-name-only: printf '\n--name-only'
# 历史树
git log --graph --oneline --decorate --all
# 清除已失效的远程分支
git remote prune origin
# 拉取项目的git子模块
git submodule update --init
# t-git or tgit
git commit -S -m '$(date --rfc-3339 seconds)'
# show file change history
git log -p -- <file_name>
# Open a new worktree
git worktree add <path> <opt-b> <branch>
$ opt-b: printf '\n-b'
# Remove a worktree
git worktree remove <opt-f> <worktree-path>
$ opt-f: printf '\n--force'
$ worktree-path: git worktree list --- --column 1