Chinaunix首页 | 论坛 | 博客
  • 博客访问: 186179
  • 博文数量: 34
  • 博客积分: 869
  • 博客等级: 准尉
  • 技术积分: 375
  • 用 户 组: 普通用户
  • 注册时间: 2012-03-08 15:55
文章分类

全部博文(34)

文章存档

2012年(34)

我的朋友

分类: 项目管理

2012-03-29 15:03:28

Git diff:
You can generate differs in any two version of your project using the git diff
for example this sample will diff between two branch
点击(此处)折叠或打开
  1. git diff master..experimental
  2. diff --git a/file1 b/file1
  3. deleted file mode 100644
  4. index 8012e4c..0000000
  5. --- a/file1
  6. +++ /dev/null
  7. @@ -1 +0,0 @@
  8. -iiadfadfa
  9. diff --git a/file2 b/file2
  10. deleted file mode 100644
  11. index 3b71a9a..0000000
  12. --- a/file2
  13. +++ /dev/null
  14. @@ -1,4 +0,0 @@
  15. -dnnnnnn
  16. -adfa
  17. diff --git a/file3 b/file3
  18. deleted file mode 100644
  19. index 8be9fd0..0000000
  20. --- a/file3
  21. +++ /dev/null
  22. @@ -1,6 +0,0 @@
  23. -annnnnnnnnnnnn

above will produce the differ in two branches if you would refer to find the diff from their common ancestor to test, you can use dots instead of two:

git diff master...test

what you will commit:

you will commonly use git diff to figuring out differences between your last commit, your index, your working directory, a common use is to simply run

git diff

which will show you changes in working directory that are not yet staged for the next commit, if you want to see what is staged for the next commit you can run

git diff –cached

also you can run git diff HEAD which shows changes in working directory since you last commit.


More diff options

if you want to see how you current working directory differs from the state of the project in another branch, you can run something like

git diff test

this will show you what is different between your current directory and the snapshot on the test branch

you can also limit the comparison to specific file and subdirectory by add a path limiter:

git diff HEAD – ./LIB


阅读(709) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~