廖一峯的 Git 教程html
git log
git log -p <filename>
git log --stat --author=someone
git show <commit-hash-id>
git log -p -2
git diff
git diff --staged
git diff HEAD
即對撤銷使用過
git add
命令的文件,撤銷其git add
操做git
git reset HEAD test.html
git log --pretty=oneline
能夠查看更爲清晰的log
windows
HEAD
表示當前版本,HEAD^
表示上一個版本,HEAD^^
表示上上一個版本,再往上 100 個版本則用HEAD~100
表示bash
Git容許咱們在版本的歷史之間穿梭,使用命令 git reset --hard commit_id
。code
穿梭前,用 git log
能夠查看提交歷史,以便肯定要回退到哪一個版本。htm
要重返將來,用 git reflog
查看命令歷史,以便肯定要回到將來的哪一個版本。教程
git clone -b <branch name> [remote repository address]
git config --global user.name "your name" git config --global user.email "your email"
git config user.name git config user.email
或者rem
git config --global -l
在 .gitconfig
文件裏面會有你先前配好的 name
和email
,只需添加下面代碼便可get
[credential] helper = store
.gitconfig
文件路徑:hash
windows 系統默認狀況:
C:\Users\Administrator
目錄Linux系統:~/.gitconfig
list
能夠簡寫爲l
git config --global --list
git config --local -l
git config --global -l
git config --system -l
積累、整理中...