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

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

Git推送(push)操作

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

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

在前面的文章中,都在要本地編寫文件代碼和提交,維護管制自己的文件版本,然后這種“自娛自樂”的方式,意義不是很大,在這里將介紹如何與其它的開發人員協同開發工作:每個開發人員都可以提交自己貢獻的代碼,并讓其他人看到和修改。

要協同多人一起工作,可通過修改操作將代碼文件最后一個確定版本提交,然后再推送變更。 推送(Push)操作將數據永久存儲到Git倉庫。成功的推動操作后,其他開發人員可以看到新提交的變化。

執行git log命令查看提交的詳細信息。最后一次提交的代碼的提交ID是:51de0f02eb48ed6b84a732512f230028d866b1ea,如下所示:

$ git log
commit 51de0f02eb48ed6b84a732512f230028d866b1ea
Author: your_name 
Date:   Fri Jul 7 23:04:16 2017 +0800

    add the sum of a & b

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

在推送(push)操作之前,如想要檢查文件代碼變化,可使用git show命令指定提交ID來查看具體的變化。

$ git show 51de0f02eb48ed6b84a732512f230028d866b1ea
commit 51de0f02eb48ed6b84a732512f230028d866b1ea
Author: your_name 
Date:   Fri Jul 7 23:04:16 2017 +0800

    add the sum of a & b

diff --git a/main.py b/main.py
index 657c8d0..25eb22b 100644
--- a/main.py
+++ b/main.py
@@ -3,5 +3,9 @@

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

-# this is a comment line

+a = 10
+
+b = 20
+c = a + b
+print("The value of c is  ", c)
\ No newline at end of file

注意:每一行代碼前面的 -號和+號。-號表示刪除,+號表示添加。如下:

-# this is a comment line

+a = 10
+
+b = 20
+c = a + b
+print("The value of c is  ", c)

如果對上面的提交修改沒有疑義,則我們就可以將文件代碼推送到遠程存儲庫中,從而讓其它開發人員可看查看和修改這些代碼,現在就來看看怎么提交這些寫好的代碼,使用以下命令:

$ git push origin master

上述命令將產生以下結果:

$ git push origin master
Username for 'http://git.oschina.net': 76972883@qq.com <輸入帳號>
Password for 'http://76972883@qq.com@git.oschina.net': <輸入登錄密碼>
Counting objects: 13, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (12/12), done.
Writing objects: 100% (12/12), 1.20 KiB | 0 bytes/s, done.
Total 12 (delta 3), reused 0 (delta 0)
To http://git.oschina.net/bjpowernode/sample.git
   290342c..51de0f0  master -> master

在上面命令中,需要您提提供( http://git.oschina.net )用戶名和密碼。

如上所示,現在代碼已經成功地提交到了遠程存儲庫( http://git.oschina.net )中了。要驗證提交的結果,遠程存儲庫中的內容是否是最后一次提交的信息,我們可以在另外一個空的目錄中或在另外一臺機器上使用 git clone 克隆出完整的文件代碼,例如,在目錄:E:\workspace 下執行以下命令:

$ git clone http://git.oschina.net/bjpowernode/sample.git
Cloning into 'sample'...
remote: Counting objects: 15, done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 15 (delta 3), reused 0 (delta 0)
Unpacking objects: 100% (15/15), done.
Checking connectivity... done.

在執行上面命令后,打開文件: E:\workspace\sample\main.py ,其代碼內容如下:

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

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

a = 10

b = 20
c = a + b
print("The value of c is  ", c)

可以看到此文件與最后一個版本的內容一樣。

全部教程
主站蜘蛛池模板: 欧美高清在线精品一区二区不卡 | 免费黄色在线网站 | 一国产大片在线观看 | 一个人在线观看的免费视频www | 美女下面粉嫩粉嫩冒白浆高清 | 黄色影院在线看 | 国产乡下三片在线观看64 | 久久久96| 欧美88888在线观看 | 亚洲欧美日韩中文综合在线不卡 | 91成人在线观看 | 免费成人黄色网址 | 欧美成人免费观看的 | 青青草国产97免久久费观看 | 日日爱网站 | 久久国产精品久久精 | 看全免费的一级毛片 | 国产99在线a视频 | 天天摸日日操 | 又黄又爽又色的黄裸乳视频 | 亚洲性夜夜综合久久麻豆 | 丁香五月网久久综合 | 免费黄色欧美视频 | 成人18免费网站在线观看 | 在线观看免费a∨网站 | 天天爽夜夜爽8888视频精品 | 麻豆日韩国产精品欧美在线 | 免费日批 | 成人久久18免费游戏网站 | 成人免费观看www视频 | 亚洲欧美日韩三级 | 99精品在线免费观看 | 国产高清精品久久久久久久 | 亚洲欧美日韩另类在线一 | 免费看h成年漫画在线观看 免费看a级 | 本道久久综合88全国最大色 | 九九热视频精品 | 一级毛片在线免费视频 | 天天射天天干天天操 | 亚洲精品二区中文字幕 | 亚洲精品专区 |