Git 官网:https://git-scm.com/
设置提交时的 NAME 和 EMAIL:
$ git config --global user.name "nikename"
$ git config --global user.email "example@example.com"
查看设置的 NAME 和 EMAIL:
$ git config user.name
$ git config user.email
做一个功能,可能提交了 10 多次,会不会有一些崩溃?单纯这么多次的 commit 就可能出现有无用,或者可以合并的 commit,就很让人不舒服。
基于上面所说问题,不难想到:每一次功能开发, 对多个 commit 进行合并或者删除处理,这时候就需要用到 git rebase
修改提交的历史 Commit
修改最近的 4 次提交纪录
git rebase -i HEAD~4
-i
是 --interactive
的缩写 - 交互的意思;HEAD~4
修改最近的 4 次提交记录;
使用ssh-keygen
生成私钥和公钥
$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/yog/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/yog/.ssh/id_rsa.
Your public key has been saved in /c/Users/yog/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:0ZYdnPILyMbV9xpgRE/hWf1MayqhoEYquZTuOMr8EcE yog@YOG-DESKTOP
The key's randomart image is:
+---[RSA 3072]----+
| =+.o.o|
| . .oo*=.oo|
| E o.o++.o++o|
| .. .=o... .o+|
| o.o ..S ....oo |
| = ..o . .... |
|o o.. . |
|=o . |
|==.. |
+----[SHA256]-----+
git log
基础查看提交日志
$ git log
commit 2c8fcc81f23aa96073250e1d052473337c968d88 (HEAD -> master, origin/master)
Author: yogwang <yogwang@yog.red>
Date: Mon Jun 17 12:10:01 2019 +0800
wrote a readme file
commit 87c9d12bdd979859811fc224c7f9ade7b97b0d13
Author: yogwang <yogwang@yog.red>
Date: Mon Jun 17 09:52:50 2019 +0800
add distributed
commit 77ac9552a7fb2e8d1f57d324d991de11efa897f2
Author: yogwang <yogwang@yog.red>
Date: Mon Jun 17 09:50:33 2019 +0800
wrote a readme file
Git 官网:https://git-scm.com/
$ git config --global user.name "nikename"
$ git config --global user.email "example@example.com"
$ git config user.name
$ git config user.email