文章来源于网络收集而来,版权归原创者所有,如有侵权请及时联系!
Compore file or change (diff)
diff
git diff 用于比较文件的修改。
git diff [options] [<commit>] [--] [<path>...]
git diff [options] --cached [<commit>] [--] [<path>...]
git diff [options] <commit> <commit> [--] [<path>...]
git diff [options] <blob> <blob>
git diff [options] [--no-index] [--] <path> <path>
前两个类似
git diff [options] [<commit>] [--] [<path>...]
git diff [options] --cached [<commit>] [--] [<path>...]
- --chched 指定工作区还是缓存区,缺失默认工作区
- commit 缺失默认比较最后一个节点。
- 不指定文件,默认比较所有文件。
例如:
比较工作区和缓存区的修改
git diff [<filename>]
比较缓存区和上一个提交的修改, 只需添加 --cached
参数
git diff --cached [<filename>]
比较工作区和历史某节点的修改
git diff <node> [<filename>]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论