$ mkdir learngit $ cd learngit $ pwd //显示当前目录 $ git init //把文件变成git可管理文件
$ git add 文件名 $ git commit -m "文件的描述"
You can add multiple files , commit once.
$ git status
$ git diff +文件名
Note that you still need to commit again after modifying the file, steps Same as the previous submission
$ git log $ git log --pretty=oneline //查看精简的信息
$ git reset --hard HEAD^ $ git reset --hard id //id是commit id(版本号)
HEAD represents the current version, the previous version is HEAD^, the previous version is HEAD^^, and so on...
$ git reflog //退回到上一个版本还能再返回来
The above is the detailed content of A complete list of common git commands. For more information, please follow other related articles on the PHP Chinese website!