其他常用命令介紹
命令
Git loggit log
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen (%cr) %C(bold blue)<%an>%Creset' --abbrev-commit –
Google
$ git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen (%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --" skyman@SKYMAN-CF7E3587 ~/manual56 (master)
git lg效果如所示:
Git config –global –
Globalgit bashgit lg
命令
Git diff xxx.mdgit diff
命令
skyman@SKYMAN-CF7E3587 ~/manual56/docs/Chapter_17 (master)
$
git checkout xxx.mdgiffcheckoutGit checkout git checkout branchname
命令
commitcommitgit rm
git
$ git rm 17.5.0.0.0.md
rm 'docs/Chapter_17/17.5.0.0.0.md'
Deletion of directory 'docs/Chapter_17' failed. Should I try again? (y/n) y
Deletion of directory 'docs/Chapter_17' failed. Should I try again? (y/n) y
$ git rm 17.5.0.0.0.md
fatal: pathspec 'docs/Chapter_17/17.5.0.0.0.md' did not match any files
ls
$ ls 17.5.0.0.0.md
ls: 17.5.0.0.0.md: No such file or directory
命令
Git rm—cached
--md
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# 17.5.0.0.0.md
#
#
/c/Documents and Settings/…/Chapter_17
fatal: pathspec 'docs/Chapter_17/17.5.0.0.0.md' did not match any files
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# 17.5.0.0.0.md
#
[master 711231b] Test change 10
1 file changed, 1 insertion(+), 1 deletion(-)
Counting objects: 9, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (5/5), 383 bytes, done.
Total 5 (delta 3), reused 0 (delta 0)
To git@github.com:mchdbagh/manual56.git
3e96f90..711231b master -> master
,
git rm –cached xxx.md命令
rm 'docs/Chapter_17/17.5.0.0.0.md'
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# 17.5.0.0.0.md
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
#
# On branch master
nothing to commit (working directory clean)
命令
git mv old-file-name new-fine-name
github