黄色网址大全免费-黄色网址你懂得-黄色网址你懂的-黄色网址有那些-免费超爽视频-免费大片黄国产在线观看

Git教程
Git標簽管理
Git分支
Git操作
Git應(yīng)用
GitHub應(yīng)用
IDEA對于Git&GitHub的支持
Git與GitHub使用注意事項

Git查看更改

在本文章教程中,我們將演示如何查看 Git 存儲庫的文件和提交記錄,并對存儲庫中的文件作修改和提交。

注意:在開始學習本教程之前,先克隆一個存儲庫,有關(guān)如何克隆存儲庫,請參考: Git克隆操作

比如,我們查看提交詳細信息后,需要修改代碼,或添加更多的代碼,或者對比提交結(jié)果。

下面使用git log命令查看日志詳細信息。

$ git log

執(zhí)行上面命令后,得到以下輸出結(jié)果:

$ git log
commit be24e214620fa072efa877e1967571731c465884
Author: your_name 
Date:   Fri Jul 7 18:58:16 2017 +0800

    ??mark

commit 5eccf92e28eae94ec5fce7c687f6f92bf32a6a8d
Author: your_name 
Date:   Fri Jul 7 18:52:06 2017 +0800

    this is main.py file commit mark use -m option

commit 6e5f31067466795c522b01692871f202c26ff948
Author: your_name 
Date:   Fri Jul 7 18:42:43 2017 +0800

    this is main.py file commit mark without use "-m" option

commit 290342c270bc90f861ccc3d83afa920169e3b07e
Author: Maxsu <769728683@qq.com>
Date:   Fri Jul 7 16:55:12 2017 +0800

    Initial commit

Administrator@MY-PC /D/worksp/sample (master)
$

使用git show命令查看某一次提交詳細信息。 git show命令采用SHA-1提交ID作為參數(shù)。

$ git show be24e214620fa072efa877e1967571731c465884
commit be24e214620fa072efa877e1967571731c465884
Author: your_name 
Date:   Fri Jul 7 18:58:16 2017 +0800

    ??mark

diff --git a/main.py b/main.py
index 91a1389..657c8d0 100644
--- a/main.py
+++ b/main.py
@@ -3,3 +3,5 @@

 print ("Life is short, you need Python !")

+# this is a comment line
+

上面顯示的結(jié)果中,可以看到符號 “+“ ,表示添加的內(nèi)容。如果有 “-”則表示刪除的內(nèi)容,現(xiàn)在我們打開 main.py ,把注釋行去掉并定義一個變量。修改后的 main.py 的內(nèi)容如下所示:

#!/usr/bin/python3
#coding=utf-8

print ("Life is short, you need Python !")

a = 10
b = 20

然后使用命令:git stauts 查看當前工作區(qū)狀態(tài):

$ git status
On branch master
Your branch is ahead of 'origin/master' by 3 commits.
  (use "git push" to publish your local commits)

Changes not staged for commit:
  (use "git add ..." to update what will be committed)
  (use "git checkout -- ..." to discard changes in working directory)

        modified:   main.py

no changes added to commit (use "git add" and/or "git commit -a")

測試代碼后,通過運行g(shù)it diff命令來回顧他的更改。

$ git diff
diff --git a/main.py b/main.py
index 95053b4..a4f953e 100644
--- a/main.py
+++ b/main.py
@@ -4,4 +4,6 @@
 print ("Life is short, you need Python !")


-number = 100
+a = 10
+
+b = 20

可以看到符號 “+“ (綠色),表示添加的內(nèi)容。如果有 “-”(紅色)則表示刪除的內(nèi)容。執(zhí)行的效果如下所示:

現(xiàn)在使用以下命令將文件:main.py 添加到 git 暫存區(qū),然后提交代碼完成:

$ git add main.py
$ git commit -m "define two var a & b "

最近修改的代碼已提交完成。

全部教程
主站蜘蛛池模板: kk4kk免费视频毛片 | 成人免费v片在线观看 | 欧美一级视频在线观看 | a级片免费网站 | 日韩综合第一页 | 成人福利在线 | 全网免费在线播放视频入口 | 日韩伦理亚洲欧美在线一区 | 成人免费在线视频网 | 第一国内永久免费福利视频 | 久久丝袜精品中文字幕 | 久综合网 | 91精品国产自产91精品 | yy3341殇情影院理论片 | 精品久久网 | 色黄污在线看黄污免费看黄污 | 九九九精品视频 | 大香人蕉免费视频75 | 网站在线观看你懂的 | 天天干在线观看 | 免费鲁丝片一级在线观看 | 中文字幕在线免费看 | 天天操夜夜操免费视频 | 性a视频 | 丝袜天堂 | 一本在线免费视频 | 91久久天天躁狠狠躁夜夜 | 看全色黄大色黄大片免责看的 | 国产精品午夜高清在线观看 | 老司机免费福利午夜入口ae58 | 99精品伊人久久久大香线蕉 | 国产黄色免费在线观看 | 99视频在线精品免费观看18 | 黄色短片视频 | 欧美成人三级一区二区在线观看 | 97日韩 | 久久精品免看国产 | 免费看欧美日韩一区二区三区 | 成人亚州| 天天夜天干天天爽 | 日韩伦理亚洲欧美在线一区 |