How to view file history in Git?

参考: http://stackoverflow.com/questions/1786027/how-to-view-file-history-in-git

Use git log to view the commit history. Each commit has an associated revision specifier that is a hash key (e.g. 14b8d0982044b0c49f7a855e396206ee65c0e787 and b410ad4619d296f9d37f0db3d0ff5b9066838b39). To view the difference between two different commits, use git diff with the first few characters of the revision specifiers of both commits, like so:

# diff between commits 14b8... and b410...
git diff 14b8..b410
# only include diff of specified files
git diff 14b8..b410 path/to/file/a path/to/file/b
If you want to get an overview over all the differences that happened from commit to commit, use git log or git whatchanged with the patch option:

# include patch displays in the commit history
git log -p
git whatchanged -p
# only get history of those commits that touch specified paths
git log path/a path/b
git whatchanged path/c path/d

gitk path/to/file
git diff path/to/file
git log path/to/file
git log

时间: 2024-10-30 04:51:48

How to view file history in Git?的相关文章

Command-cat, tac, file, history, tree,tee…

文中 --> 为开头的为命令行的输出. 涉及到的命令有,cat, tac, file, history, tree, more, less, tail, head, touch, cp, mv, rm,,tr,tee, wc, cut, sort, uniq cat cat – 连接文件(S),或标准输入,到标准输出. #SYNOPSIS cat [OPTION]... [FILE]... ## -A, --show-all 等价于 -vET $ ## -b, --number-nonblank

Rewriting History with Git Rebase

http://code.tutsplus.com/tutorials/rewriting-history-with-git-rebase--cms-23191 1. Rebasing for a Linear HistoryThe first use case we'll explore involves a divergent project history. Consider a repository where your production branch has moved forwar

[Practical Git] Filter commit history with git log arguments

In the last lesson, we learned how to format the git log output; in this lesson we will learn how to filter down to a specific set of commits. By default, git log shows every commit in a repo. We will walk through using a bunch of options to filter o

[Practical Git] Compare file changes with git diff

It can be helpful to see the changes between two sets of code; git diff lets us do this by comparing two Git references and outputting the differences between them. In this lesson, we show how to use git diff along with the --stat, --cached, HEAD, or

[Practical Git] Format commit history with git log arguments

When running the git log command, we can pass in options as arguments toformat the data shown for each commit. In this lesson, we show how to use the oneline, decorate, graph, stat, and p options with git log. Show it oneline: git log --oneline git l

git查看某个文件修改历史

[git查看某个文件修改历史] 1.使用git命令 git whatchanged charge.lua 显示某个文件的每个版本提交信息:提交日期,提交人员,版本号,提交备注(没有修改细节) git show 7aee80cd2afe3202143f379ec671917bc86f9771 显示某个版本的修改详情 2.visual studio code可以加载git history插件. Press F1 and select/type "Git: View History (git log)

Git Tutorial 7 - File States

File States Overview Every file in your working directory is mainly in one of 2 states: 1. Tracked : All files that were committed to the last snapshot in Git repository are in state Tracked. They can be one of the following states: 1.1 Unmodified : 

GIT提交代码出错File exists.

今天合并代码的时候执行了 git status 出现了下面的执行命令no changes added to commit (use "git add" and/or "git commit -a")执行了 git add 就报下面的错误了 fatal: Unable to create 'D:/3.0项目和资料/3.0项目/fanuc-部署项目/frame-static/.git/index.lock': File exists. Another git proce

Git详解之五 分布式Git

来自:http://www.open-open.com/lib/view/open1328070090108.html 分布式 Git 为了便于项目中的所有开发者分享代码,我们准备好了一台服务器存放远程 Git 仓库.经过前面几章的学习,我们已经学会了一些基本的本地工作流程中所需用到的命令.接下来,我们要学习下如何利用 Git 来组织和完成分布式工作流程. 特别是,当作为项目贡献者时,我们该怎么做才能方便维护者采纳更新:或者作为项目维护者时,又该怎样有效管理大量贡献者的提交. 5.1  分布式工