图解 Git 工作原理
共 3830字,需浏览 8分钟
· 2021-05-14
链接:http://marklodato.github.io/visual-git-guide/index-zh-cn.html
![](https://filescdn.proginn.com/20763f016e7e57039e795a83680a6a0a/baf89a008757b3e2836f76b382b4906a.webp)
![](https://filescdn.proginn.com/494302550741593956360773e8c8ed67/2e17ca16eb2ebef01b61f4a805fd2dc3.webp)
git add files把当前文件放入暂存区域。
git commit给暂存区域生成快照并提交。
git reset – files用来撤销最后一次git add files,你也可以用git reset撤销所有暂存区域文件。
git checkout – files把文件从暂存区域复制到工作目录,用来丢弃本地修改。
![](https://filescdn.proginn.com/0d6dcacd930379faf4cdfc0e2133ac43/143418b9ca35fca0f6c4c269ec344909.webp)
git commit -a相当于运行git add把所有当前目录下的文件加入暂存区域再运行。
git commit files进行一次包含最后一次提交加上工作目录中文件快照的提交。并且文件被添加到暂存区域。
git checkout HEAD – files回滚到复制最后一次提交。
![](https://filescdn.proginn.com/20763f016e7e57039e795a83680a6a0a/baf89a008757b3e2836f76b382b4906a.webp)
![](https://filescdn.proginn.com/433721338173370d188121b617777826/2fe5e9413c0dadccd78798b6a03f5351.webp)
![](https://filescdn.proginn.com/20763f016e7e57039e795a83680a6a0a/baf89a008757b3e2836f76b382b4906a.webp)
![](https://filescdn.proginn.com/5a00175e8832a400c068c41d9981e7c5/2df89ca65b5000255f40b142ca647767.webp)
![](https://filescdn.proginn.com/02f867579643435e1c0151849afd3dea/ad0475b8eaf9935eafec2c4fe8fa901a.webp)
![](https://filescdn.proginn.com/f7aadaf87df269c6c6412d2bab696ffd/06f8434544edd43ce667399c445b1619.webp)
![](https://filescdn.proginn.com/99a2421a4373947d3e4cc864d2024896/2d3c481301a2c54124df699ca27f045a.webp)
![](https://filescdn.proginn.com/7adaffb96a87a4e2bab6882dae072466/d0f5ee969dc14aee4831860b72950e2b.webp)
![](https://filescdn.proginn.com/95d77c2493e24f7bb66dfe610e4590ee/858883a7c8bc1e7e7b3f212c4d4f00ba.webp)
![](https://filescdn.proginn.com/92fdd8c56032c13c337be4f73a226882/9777bc5b3168953cceffadb21e4c0e13.webp)
![](https://filescdn.proginn.com/65ecc5294613fc9e176e9f8946911cfa/ec1e9d949f7629837fa3b56f872bd806.webp)
![](https://filescdn.proginn.com/065dcf1cc856e2f402695569d656a856/f5d568ff5f64fd58f2265d65c40489a5.webp)
![](https://filescdn.proginn.com/125122237889e1a513e7972698d0dc5b/0914b32797bda4b21cdb618ba00a20a7.webp)
![](https://filescdn.proginn.com/1430ecf4f44350ae887f73e3c87b260f/fd57e5363788b26af3dc2cd13e49fbcc.webp)
![](https://filescdn.proginn.com/597ddfe263eb05403c167f1107c75997/d837da7d885c2e3897eefa68760f2bd5.webp)
![](https://filescdn.proginn.com/8bf708bb2e544cb3a1d6e175338c5ab6/b38984a03282ba56b62739915b12745e.webp)
![](https://filescdn.proginn.com/f2d7dc4f573df589fffefdf3bc101444/9b9d02de8327a96908b1b985c783372f.webp)
![](https://filescdn.proginn.com/e9609217e63c2f55fe605a1043cfa04d/bd1485ec6d29e6abb71c2b1ae8a062e6.webp)
![](https://filescdn.proginn.com/e06bdf7a9f66d7b4a1cc573d5b5dfb26/f10117b73b7faa98967887bcb8f47276.webp)
![](https://filescdn.proginn.com/92238aaea6408e89169b6e10b387c83c/5f8bec5cff4a64c698578c784276da30.webp)
![](https://filescdn.proginn.com/6e1273b182140160e240cd69bcd5d017/38b524e20d642af8eb67d994b841f80b.webp)
![](https://filescdn.proginn.com/20763f016e7e57039e795a83680a6a0a/baf89a008757b3e2836f76b382b4906a.webp)
http://marklodato.github.io/visual-git-guide/index-zh-cn.html#merge
http://marklodato.github.io/visual-git-guide/index-zh-cn.html#rebase
http://marklodato.github.io/visual-git-guide/index-zh-cn.html#detached
http://en.wikipedia.org/wiki/Three-way_merge
http://www.kernel.org/pub/software/scm/git/docs/git-rebase.html#_interactive_mode
看完这篇文章,你有什么收获?欢迎在留言区与10w+Java开发者一起讨论~
1、GitHub 标星 3.2w!史上最全技术人员面试手册!FackBoo发起和总结
5、37岁程序员被裁,120天没找到工作,无奈去小公司,结果懵了...