从Viewing the Commit History了解 git log 比较容易。 --decorate: Print out the ref names of any commits that are shown. --all: Pretend as if all the refs in refs/ are listed on the command line as <commit>. git log --pretty=oneline --decorate --all -3 7055c613f081be5bd063d4695...
$ git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit * 3396763 - (HEAD, origin/master, master) Add twitter link (4 days ago)* c73bbc9 - add facebook link (6 days ago)* cb555df - More rando...
# Only list commits that are parent of the second parent of a merge commitgit log HEAD^2# Remove the last 3 commits from the current branchgit reset HEAD~3# Interactively rebase the last 3 commits on the current branchgit rebase -i HEAD~3 Reflog 作为Git的保险装置,reflog记录了几乎所有你...
git log -p: by supplying a SHA, the output of the commandgit log -pwillstart at that commit(the command will also show all of the commits that were made prior to the supplied SHA). git show (displays information about the given commit) Usinggit showis another method to show a specifi...
git-show - Show various types of objects SYNOPSIS git show[<options>] […] DESCRIPTION Shows one or more objects (blobs, trees, tags and commits). For commits it shows the log message and textual diff. It also presents the merge commit in a special format as produced bygit diff-...
git diff HEAD^ HEAD -(HEAD = current branch’s tip),( HEAD^ = version before the last commit) 3. git diff HEAD^ HEAD — ./file (comparison to specified file) 4. git diff HEAD~5 HEAD - (HEAD~5 refers to the last 5 commits.) Share Improve this answer Follow answered Jun 7,...
比如,A commit 在 main.c 中增加了三行,revert A 产生的 commit 就会删除这三行。如果我们非常确定之前的某个 commit 产生了 bug,最好的办法就是 revert 它。git revert 后 git 会提示写一些 commit message,此处最好简单描述为什么要还原;而重置(reset)会修改历史,常用于还没有 push 的本地 commits。
Squashing commits 是指将多个连续的 Git 提交合并成一个单独的提交。这个过程会将一系列相关的提交整合成一个更大的提交,以便更清晰地记录项目历史或减少提交历史中的噪音。 使用指令git rebase -i 具体来说需要一个进行合并的最老的commit,和一个最新的commit。一般来说默认是现在的HEAD,然后执行上述命令后,可以...
Show commits logs. git log [] [] [[\--] ...] 默认不加任何参数,git log会按提交时间从晚到早(从新到旧)列出所有的更新,会显示一个SHA-1校验和,作者名字和邮件地址,提交时间,最后一个缩进段落显示提交说明。 -p展开显示每次提交和之前上一次提交的内容差异,用-2仅显示最近两次更新。
If you want to show all commits reachable from A, but exclude those reachable from B: git log A ^B # read: A, but *not* B or, more in line with the general usage of git log: git log B..A # read: show history from B to A ...