赞
踩
新项目,一个分支,提交十多次后发现第二次的提交影响了项目运行,且提交量较大(请不要问为什么十多次后才发现。。。)
i
,进入编辑模式,删除想要删除的提交记录(带pick的整行)pick 5e6538d feat: init
pick 6797239 feat: 1
pick 760bddd feat: 2
pick 760bddd feat: 3
pick 760bddd feat: 4
pick 760bddd feat: 5
pick 760bddd feat: 6
pick 760bddd feat: 7
pick 760bddd feat: 8
pick 760bddd feat: 9
# Rebase e3c3121..760bddd onto e3c3121 (3 commands)
#
# Commands:
# p, pick <commit> = use commit
# r, reword <commit> = use commit, but edit the commit message
# e, edit <commit> = use commit, but stop for amending
# s, squash <commit> = use commit, but meld into previous commit
# f, fixup <commit> = like "squash", but discard this commit's log message
# x, exec <command> = run command (the rest of the line) using shell
# b, break = stop here (continue rebase later with 'git rebase --continue')
# d, drop <commit> = remove commit
# l, label <label> = label current HEAD with a name
# t, reset <label> = reset HEAD to a label
# m, merge [-C <commit> | -c <commit>] <label> [# <oneline>]
# . create a merge commit using the original merge commit's
# . message (or the oneline, if no original merge commit was
# . specified). Use -c <commit> to reword the commit message.
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out
具体提交信息使用1、2、3。。代替
Successfully rebased and updated refs/heads/master.
error: could not apply 6fa7b3b... update lock
Resolve all conflicts manually, mark them as resolved with
"git add/rm <conflicted_files>", then run "git rebase --continue".
You can instead skip this commit: run "git rebase --skip".
To abort and get back to the state before "git rebase", run "git rebase --abort".
两种情况:
git rebase --skip
add
后:git rebase --continue
持续按这两种情况进行操作,直到正常显示:
Successfully rebased and updated refs/heads/master.
git log 用来查看历史提交记录,不传入任何参数的默认情况下,git log 会按时间倒序列出所有的提交记录,列出内容包括每个提交的
commit ebde2bc1e13e9e3309bca8f1f4c8f1367b4331c2 (HEAD -> master, origin/master, origin/HEAD)
- 唯一标识此次提交(重复的可能性可以忽略不计)
- 第一条提交记录后会标出本地所在分支
Author: AImooc_iseeu <1131209806@aimooc.top>
Date: Mon May 29 18:00:19 2023 +0800
feat: 10.1.2 使用 useCallback 解决无限渲染问题
历史较多时会只展示一部分
q
,退出查看git log -n
git log -5
显示 2023年5月3日 之后的 commit (包含)。
git log --after="2023-5-3"
git log --since="2023-5-3"
git log --before="2023-5-3"
git log --until="2023-5-3"
日期还可以是相对日期,比如"1 week ago"和”yesterday"。
--after
与--since
功能相同。--before
与--until
功能相同.
git log --author="name"
git log --author="email"
- 模糊匹配
- 支持正则
git log --pretty=oneline
dc2227ce64f5a8cb05f3bc3cf8dfd2e7eea0a9e5 feat: 9.3 自定义 Star 组件做项目收藏标记
1dabd22132f81cf8f1d9d501bfce6701da969a32 feat: 9.2 抽象user-select组件选择用户
e3f1c34991dab267730edad65f09534a6f794202 feat: 9.1 实现id-select.tsx解决id类型 难题
63797fa1f39f486d5347c3762032982b227ed68b feat: 8.6 & 8.7 用useMemo解决依赖循环问题;完成URL状态管理
b939f13a679197463aa3d51cb6ee315ab548ef81 feat: 8.5 初步实现 useUrlQueryParam 管理 URL 参数状态(有循环渲染bug)
80b1003a68e043833b8efe01db215c953ff6a40a feat: 8.4 添加看板和任务组路由
a0bc50ceac71b870a1c1b4785d9d42fe169a90b9 feat: 8.3 添加项目列表和项目详情路由
c32479df405d617420c302ac0592df8666e6697d feat: 8.2 用 useRef 优化 useDocumentTitle
eb2f5c834233ded62b65e1ae506683bc04ae3937 feat: 8.1 用 useDocumentTitle 改变文档标题
ab288ba963146ee7af70c788484395a0a775420f feat: 7.5 实现 Error Boundaries,捕获边界错误
b5ea43574fa1e3d5a989f32f574a24577b3b5eca feat: 7.3 用 useAsync 获取用户信息,新增全屏 Loading 组件 和 全屏 Error 展示组件
e5fac1dd70adbc1eaeeae8884ac31b19cac61629 feat: 7.2 登录注册页面 Loading 和 Error 状态处理
fc01fcc7984f445a8d8b4130430829ea3e415cd1 feat: 7.2 自定义Hook-useAsync统一处理Loading和Error状态
- p(相当于多次使用
git show [commit_id]
)- oneline
- short
- medium(默认)
- full
- fuller
- raw(提交ID,文件树ID,父提交ID,作者和提交者)
- format
-S "<string>"
:普通匹配git log -S "useAsync"
-G "<string>"
:正则匹配注意,前两个都是:仅显示添加或删除内容匹配指定字符串的提交
--grep
git log --grep "登录"
仅显示提交说明中包含指定字符串的提交。
注意:
- 直接跟使用引号包裹的字符串即可,不用跟等号(=)
- 默认匹配模式是区分大小写的,可以追加
-i
不区分大小写
git log 500883036f0d94894a565e603ed8a3543d6ba716
其他参数:
- -p :查看提交时的补丁信息(patch的缩写)。
- –stat :列出文件的修改行数。
- –sortstat:只显示–stat中最后行数修改添加移除的统计。
- –graph:以简单的图形方式列出提交记录。(绘制提交的线索,如果有合并的话,也会更清晰地显示出来)
- –abbrev-commit:仅显示 SHA-1 的前几个字符,而非所有的 40 个字符。
- –relative-date:使用较短的相对时间显示(“1 weeks ago”)。
- –name-only:仅在提交信息后显示已修改的文件清单。
- –name-status:显示新增、修改、删除的文件清单。
git log --name-status --oneline
PS E:\Projects\Jira> git log --name-status --oneline ebde2bc (HEAD -> master, origin/master, origin/HEAD) feat: 10.1.2 使用 useCallback 解决无限渲染问题 M src/utils/http.ts M src/utils/project.ts M src/utils/use-async.ts 469b914 feat: 10.1.1 阻止在已卸载组件上赋值 M src/screens/ProjectList/index.tsx M src/utils/index.ts M src/utils/use-async.ts 5008830 feat: 9.5 完成编辑后刷新功能 M src/screens/ProjectList/components/List.tsx M src/screens/ProjectList/index.tsx M src/utils/project.ts M src/utils/use-async.ts 04295e7 feat: 9.4 M src/screens/ProjectList/index.tsx M src/utils/use-async.ts dc2227c feat: 9.3 自定义 Star 组件做项目收藏标记 A src/components/star.tsx M src/context/auth-context.tsx M src/screens/ProjectList/components/List.tsx M src/screens/ProjectList/index.tsx M src/unauthenticated-app/login.tsx M src/unauthenticated-app/register.tsx A src/utils/project.ts D src/utils/use-projects.ts
- 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
git log --stat --oneline --graph
* ebde2bc (HEAD -> master, origin/master, origin/HEAD) feat: 10.1.2 使用 useCallback 解决无限渲染问题 | src/utils/http.ts | 8 +++-- | src/utils/project.ts | 11 +++--- | src/utils/use-async.ts | 76 ++++++++++++++++++++++------------------ | 3 files changed, 53 insertions(+), 42 deletions(-) * 469b914 feat: 10.1.1 阻止在已卸载组件上赋值 | src/screens/ProjectList/index.tsx | 2 +- | src/utils/index.ts | 16 ++++++++++++++++ | src/utils/use-async.ts | 4 +++- | 3 files changed, 20 insertions(+), 2 deletions(-) * 5008830 feat: 9.5 完成编辑后刷新功能 | src/screens/ProjectList/components/List.tsx | 4 +++- | src/screens/ProjectList/index.tsx | 9 ++++++--- | src/utils/project.ts | 4 +++- | src/utils/use-async.ts | 14 +++++++++----- | 4 files changed, 21 insertions(+), 10 deletions(-) * 04295e7 feat: 9.4 | src/screens/ProjectList/index.tsx | 11 +++++++++-- | src/utils/use-async.ts | 7 +++++++ | 2 files changed, 16 insertions(+), 2 deletions(-) * dc2227c feat: 9.3 自定义 Star 组件做项目收藏标记 | src/components/star.tsx | 17 ++++++ | src/context/auth-context.tsx | 2 +- | src/screens/ProjectList/components/List.tsx | 18 ++++++- | src/screens/ProjectList/index.tsx | 2 +-
- 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
git log --pretty="%cn committed %h on %cd"
AImooc_iseeu committed ebde2bc on Mon May 29 18:49:45 2023 +0800
AImooc_iseeu committed 469b914 on Mon May 29 18:00:19 2023 +0800
AImooc_iseeu committed 5008830 on Fri May 26 19:51:12 2023 +0800
AImooc_iseeu committed 04295e7 on Fri May 26 18:33:50 2023 +0800
AImooc_iseeu committed dc2227c on Thu May 25 18:38:36 2023 +0800
AImooc_iseeu committed 1dabd22 on Wed May 24 18:23:06 2023 +0800
AImooc_iseeu committed e3f1c34 on Wed May 24 10:09:38 2023 +0800
AImooc_iseeu committed 63797fa on Tue May 23 18:49:53 2023 +0800
AImooc_iseeu committed b939f13 on Fri May 19 18:37:37 2023 +0800
git log -p -1
)15532312345 (1):
Initial commit
AImooc_iseeu (56):
init
update lock
update tsconfig.baseUrl
add npm prettier
add .prettierrc.json
add .prettierignore
add npm husky & lint-staged
add npm eslint-config-prettier
add commitlint.config.js
del 6
recommit
feat: add commit-msg
feat: add json-server config & db.json
feat: add projectList
feat: add env
- git shortlog -s:可以用来统计每个作者的commit数量
- git shortlog -n:可以用来对统计的量进行倒序排列
文档:Git - 查看提交历史
待续。。。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。