[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--cachedHEADorigin/masterfile(s)/dir(s) options.

If you want to see the difference between stagin area with last commit:

git diff --cached

See the all umcommit changes:

git diff HEAD

See the different with branch:

git diff origin/master   //will show all the change which in local but not in remote master

Compare the file with remote branch:

git diff origin/master getRandomNumber.js  // show the difference between local getRandomNumber.js file with remote master branch
上一篇:java图片压缩(Thumbnails)


下一篇:完整java开发中JDBC连接数据库代码和步骤