git使用小记---比较
变化比较
- git diff
比较当前未add文件与上一次add文件的区别(workingtree与index)
git diff [--options] [--] […?]//eg.git diff master -- Folder/develop -- Folder/
git diff [filename]//eg.git diff MyFlder/
比较未commit文件的与上次commit文件的区别(index与HEAD)
git diff --cached [filename]
【git使用小记---比较】比较未add文件与上次commit文件的区别(workingtree与HEAD)
git diff HEAD [filename]
文章图片
workingtree->index->HEAD
- git add -p
会显示当前未add文件与working tree文件的区别,并可选择add的方式
Stage this hunk [y,n,q,a,d,/,s,e,?]? n
y - stage this hunk
n - do not stage this hunk
q - quit;
do not stage this hunk or any of the remaining ones
a - stage this hunk and all later hunks in the file
d - do not stage this hunk or any of the later hunks in the file
g - select a hunk to go to
/ - search for a hunk matching the given regex
j - leave this hunk undecided, see next undecided hunk
J - leave this hunk undecided, see next hunk
k - leave this hunk undecided, see previous undecided hunk
K - leave this hunk undecided, see previous hunk
s - split the current hunk into smaller hunks
e - manually edit the current hunk
? - print help
另附一个将不同命令执行后workingtree, index 和 HEAD之间变化的关系图。workflow
文章图片
推荐阅读
- 由浅入深理解AOP
- 【译】20个更有效地使用谷歌搜索的技巧
- mybatisplus如何在xml的连表查询中使用queryWrapper
- MybatisPlus|MybatisPlus LambdaQueryWrapper使用int默认值的坑及解决
- MybatisPlus使用queryWrapper如何实现复杂查询
- 私通和背叛,他怎么看(——晨读小记)
- gitlab|gitlab 通过备份还原 admin/runner 500 Internal Server Error
- iOS中的Block
- Linux下面如何查看tomcat已经使用多少线程
- 使用composer自动加载类文件