git diff 命令用法
理解git diff的前提,首先要理解git中工作区,暂存区,本地版本库的概念,如果头脑中有这些概念,接着往下读。 git diff test.c 用来查看工作区和暂存区中test.c文件的区别。 git diff HEAD -- test.c 用来查看工作区和本地版本库中test.c文件的区别。 eg: a. 在工作区中修改文件cfm_test.c,git diff cfm_test.c 和 git diff HEAD -- cfm_test.c 分别输出如下: [3me]$ git diff cfm_test.c @@ -45,7 +45,11 @@ cfm_test_init () tst->tst_data = XCALLOC (MTYPE_ITUT_CFM_MSG, CFM_TST_PDU_MAX_LENGTH); if (!tst->tst_data) { - XFREE (MTYPE_ITUT_CFM_MSG, tst->tst_data); +#if defined(CONFIG_DS_COVERITY) + XFREE( MTYPE_ITUT_CFM_TST, tst); +#else + XFREE (MTYPE_ITUT_CFM_MSG, tst->tst_data); +#endif return NULL; } [3me]$ git diff HEAD -