Git學習-->其他常用命令介紹

來源:互聯網
上載者:User

其他常用命令介紹

 

命令

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

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.