前言
在乐字节公开课上学习了git原理,分享出来大家学习。
正文

本文图解Git中的最常用命令。如果你稍微理解Git的工作原理,这篇文章能够让你理解的更透彻。
基本用法

上面的四条命令在工作目录、暂存目录(也叫做索引)和仓库之间复制文件。
git add files把当前文件放入暂存区域。
git commit给暂存区域生成快照并提交。
git reset – files用来撤销最后一次git add files,你也可以用git reset撤销所有暂存区域文件。
git checkout – files把文件从暂存区域复制到工作目录,用来丢弃本地修改。
你可以用git reset -p,git checkout -p,or git add -p进入交互模式。
在乐字节公开课上学习了git原理,分享出来大家学习。
正文

本文图解Git中的最常用命令。如果你稍微理解Git的工作原理,这篇文章能够让你理解的更透彻。
基本用法

上面的四条命令在工作目录、暂存目录(也叫做索引)和仓库之间复制文件。
git add files把当前文件放入暂存区域。
git commit给暂存区域生成快照并提交。
git reset – files用来撤销最后一次git add files,你也可以用git reset撤销所有暂存区域文件。
git checkout – files把文件从暂存区域复制到工作目录,用来丢弃本地修改。
你可以用git reset -p,git checkout -p,or git add -p进入交互模式。