1、git的简单命令

  git init: 初始化git

mashiqiandeMBP:c mashiqian$ git init
Initialized empty Git repository in /Users/mashiqian/Desktop/c/.git/

  git status:查看git状态

mashiqiandeMBP:c mashiqian$ git status
On branch master

No commits yet

Untracked files:
  (use "git add <file>..." to include in what will be committed)

    login.py

nothing added to commit but untracked files present (use "git add" to track)

  git add:添加到暂存区

mashiqiandeMBP:c mashiqian$ git add login.py

  这时再次查看git状态

mashiqiandeMBP:c mashiqian$ git status
On branch master

No commits yet

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)

    new file:   login.py

  git commit -m '注释':将文件提交到本地仓库

mashiqiandeMBP:c mashiqian$ git commit -m '立项'
[master (root-commit) 3448e89] 立项
 Committer: 麻世骞 <[email protected]>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly. Run the
following command and follow the instructions in your editor to edit
your configuration file:

    git config --global --edit

After doing this, you may fix the identity used for this commit with:

    git commit --amend --reset-author

 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 login.py

  此时再次查看git状态

mashiqiandeMBP:c mashiqian$ git status
On branch master
nothing to commit, working tree clean

  git log:查看日志

mashiqiandeMBP:c mashiqian$ git log
commit 3448e89964aae9f17442d486ec634e96df6edda8 (HEAD -> master)
Author: 麻世骞 <[email protected]>
Date:   Thu Sep 19 15:06:52 2019 +0800

    立项

  git config user.name '添加内容':添加作者名字

  git config user.email '邮箱':添加作者邮箱

mashiqiandeMBP:c mashiqian$ git config user.name '麻世骞'
mashiqiandeMBP:c mashiqian$ git config user.email '[email protected]'

  此时再查看日志

mashiqiandeMBP:c mashiqian$ git log
commit 9284b04c236ac825cc8c4f493098796ef61bd281 (HEAD -> master)
Author: 麻世骞 <[email protected]>
Date:   Thu Sep 19 15:17:31 2019 +0800

    添加了一个变量
02-11 14:49