http://stackoverflow.com/questions/9903541/finding-diff-between-current-and-last-versions

As pointed out on a comment by amalloy, if by "current and last versions" you mean the last commit and the commit before that, you could simply use

git show
answered Oct 14 '15 at 17:46
Nighto

1,081921
 
3  
This is what I was looking for. Great answer. – CodeManiak Jan 19 at 22:50
3  
Simpler. This should be the accepted answer. – jbmusso Mar 2 at 9:21
6  
Use git show HEAD~1 to show the last-but-one commit, and git show HEAD~2, etc. for older commits. Show just a single file via git show HEAD~2 my_file. – Florian Brucker Mar 3 at 10:43

Assuming "current version" is the working directory (uncommitted modifications) and "last version" is HEAD (last committed modifications for the current branch), simply do

git diff HEAD

credit for following goes to user Cerran

And if you always skip the staging area with -a when you commit, then you can simply use git diff.

Summary

  1. git diff shows unstaged changes.
  2. git diff --cached shows staged changes.
  3. git diff HEAD shows all changes (both staged and unstaged).

Source: git-diff(1) Manual Page – Cerran

answered Mar 28 '12 at 8:17
CharlesB

43.3k12118141
 
14  
And if you always skip the staging area with -a when you commit, then you can simply use git diff. <1> git diff shows unstaged changes. <2> git diff --cached shows staged changes. <3> git diff HEAD shows all changes (both staged and unstaged). Source: git-diff(1) Manual Page – Cerran Feb 20 '14 at 13:16 
    
This is a good summary. Could be an answer. – user3527975 May 4 at 18:11

git 查看当前与上一次version的差异的更多相关文章

  1. Git 查看提交历史(分布式版本控制系统)

    1.查看提交历史 在提交了若干更新,又或者克隆了某个项目之后,你也许想回顾下提交历史.完成这个任务最简单而又有效的工具是 git log 命令. $ git log commit ca82a6dff8 ...

  2. 【Azure 应用服务】App Service 在使用GIt本地部署,上传代码的路径为/home/site/repository,而不是站点的根目录/home/site/wwwroot。 这个是因为什么?

    问题描述 App Service 在使用GIt本地部署,上传代码的路径为/home/site/repository,而不是站点的根目录/home/site/wwwroot. 这个是因为什么? 并且通过 ...

  3. Git 查看某个版本修改了哪些文件

    . . . . . 查看某个版本提交了哪些文件,其实就是查看该版本与其上一个版本之间的差异,所以通过 git diff 命令来取得结果,并且对比的是要查看的版本与它的上一个版本的 commit 号. ...

  4. Git是目前世界上最先进的分布式版本控制系统

    一:Git是什么? Git是目前世界上最先进的分布式版本控制系统. 二:SVN与Git的最主要的区别? SVN是集中式版本控制系统,版本库是集中放在中央服务器的,而干活的时候,用的都是自己的电脑,所以 ...

  5. 深入学习:Windows下Git入门教程(上)

    一,安装Git: 1.1Linux上安装命令: sudo apt-get install git 1.2在Windows上安装Git: 使用Windows版的msysgit,官方下载地址:http:/ ...

  6. Git查看、删除、重命名远程分支和tag【转】

    转自:http://zengrong.net/post/1746.htm 本站文章除注明转载外,均为本站原创或者翻译. 本站文章欢迎各种形式的转载,但请18岁以上的转载者注明文章出处,尊重我的劳动,也 ...

  7. git 查看文件修改记录

    今天追了个几年前留下来的坑, 在 git 里追溯修改过程坑死个爹, 具体方法估计没多久又会忘, 还是记下来以后有的参考 大部分教程都会告诉大家使用 git log 来查看对应文件的修改记录, 就像这样 ...

  8. 深入学习:Windows下Git新手教程(上)

    版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/huangyabin001/article/details/35557231 一,安装Git: 1.1 ...

  9. git hub命令,上传到github

    git hub命令,上传到github   1,git  init;      初始化 2,git   config   --global   user.email  " ....@.... ...

随机推荐

  1. Node.js:常用工具util

    概要:本篇博客的主要内容是介绍node.js的常用工具util. 1.util.inherits util.inherits(constructor,superConstructor)是一个实现对象间 ...

  2. css3制作导航栏

    <!doctype html><html lang="en"><head>    <meta charset="UTF-8&qu ...

  3. Apache httpd.conf配置详解

    常用配置指令说明 1. ServerRoot:服务器的基础目录,一般来说它将包含conf/和logs/子目录,其它配置文件的相对路径即基于此目录.默认为安装目录,不需更改. 语法:ServerRoot ...

  4. hdu_4283_You Are the One(区间DP)

    题目链接:hdu_4283_You Are the One 题意: 有n个人,每个人有个屌丝值,如果果他是第K个上场,不开心指数就为(K-1)*D,然后有个小黑屋,可以调整他们的出场顺序,现在让你调整 ...

  5. hdu_2825_Wireless Password(AC自动机+状压DP)

    题目链接:hdu_2825_Wireless Password 题意: 给你m个串,问长度为n至少含k个串的字符串有多少个 题解: 设dp[i][j][k]表示考虑到长度为i,第j个自动机的节点,含有 ...

  6. 2DToolkit官方文档中文版打地鼠教程

    初始设置 创建一个Unity项目,并导入2D Toolkit插件. 导入完成后,在Project窗口会显示TK2DROOT文件夹(后续版本文件夹名称或许会有变动). 导入素材游戏,你可以从这里下载.下 ...

  7. 屏幕坐标和世界坐标的转换+对象池技术(3D打地鼠小游戏)

    游戏中可能经常会遇到需要某个物体跟着鼠标移动,然后又需要把物体放在某个鼠标指定的位置 实现方式 Camera.main.WorldToScreenPoint Camera.main.ScreenToW ...

  8. 大规模Schedule任务实现方案

    package com.itlong.bjxizhan.support.web.job.base; import com.itlong.bjxizhan.common.DbContext; impor ...

  9. Delphi的StringReplace[转]

    原文:http://blog.csdn.net/genispan/article/details/4458319 function StringReplace (const S, OldPattern ...

  10. error LNK2001:unresolved external symbol "xxx:static xxx"

    一般是在类的头文件里定义了某个static变量而没有在类的 Implemention 里去初始化(也许不是这么称呼)这个变量. 比如在 xxdlg.h 中写了如下代码 1: class CxxDlg ...