2020-04-07

git:查看系统有没有安装Git

设置全局属性,用户名和邮箱

C:\Users\98100>git config--globaluser.name"AithusaDou"

C:\Users\98100>git config--globaluser.email"[email protected]"   

git init:创建版本库

C:\Users\98100>d:

D:\>mkdir learngit

D:\>cd learngit

D:\learngit>git init

Initialized empty Git repository in D:/learngit/.git/

git add hello.txt:将文件添加到临时区

D:\learngit>gitaddhello.txt

git status:查看当前的Git仓库状态

D:\learngit>git status

On branch master

Initial commitChanges to be committed:

(use"git rm --cached ..."to unstage)

new file:hello.txt

git commit -m “create hello.txt file”:把文件提交

D:\learngit>git commit -m"create hello.txt file"

[master(root-commit)d096a64] create hello.txt file

 1 file changed,1insertion(+)

create mode 100644 hello.txt

git log:查看从近到远的提交日志

D:\learngit>git log

commit6757e227e580a6e6becf59b7c1a8b021e0195a71(HEAD>master)

Author:AithusaDou<[email protected]>

Date:Mon Sep1708:56:312018+0800

add a new line

commit d096a6428f66725637688b4d9b81f45be5ea2a64

Author:AithusaDou<[email protected]>

Date:Mon Sep1708:54:372018+0800

create hello.txt file

git reset --hard commit_id:退回到某一版本

D:\learngit>git reset--hard d096a

HEADisnow at d096a64 create hello.txt file

git diff:查看文件修改内容

git log --pretty=online:简略日志

git reflog:查看命令历史

git reset --hard HEAD:退回到上一版本

你可能感兴趣的:(2020-04-07)