Home > Web Front-end > JS Tutorial > body text

A complete list of common git commands

一个新手
Release: 2017-09-26 10:15:14
Original
1529 people have browsed it


Initialize a warehouse

$ mkdir learngit
$ cd learngit
$ pwd               //显示当前目录
$ git init          //把文件变成git可管理文件
Copy after login

Submit files to the warehouse

$ git add 文件名
$ git commit -m "文件的描述"
Copy after login

You can add multiple files , commit once.

Check the current status

$ git status
Copy after login

Check the difference from before

$ git diff +文件名
Copy after login

Note that you still need to commit again after modifying the file, steps Same as the previous submission

View the commit log from the latest to the farthest

$ git log
$ git log --pretty=oneline //查看精简的信息
Copy after login

Return to the previous version (status)

$ git reset --hard HEAD^   
$ git reset --hard id  //id是commit id(版本号)
Copy after login

HEAD represents the current version, the previous version is HEAD^, the previous version is HEAD^^, and so on...

Record every command you make

$ git reflog      //退回到上一个版本还能再返回来
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!