大战熟女丰满人妻av-荡女精品导航-岛国aaaa级午夜福利片-岛国av动作片在线观看-岛国av无码免费无禁网站-岛国大片激情做爰视频

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

Git提交更改

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

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

在上一步中,我們已經修改了 main.py 文件中的代碼,在代碼中定義了兩個變量并提交代碼,但是要再次添加和修改main.py 文件中的代碼,實現新功能:求兩個變量相加值。修改提交的操作更改包含提交消息的最后一個提交; 它創建一個新的提交ID。

在修改操作之前,檢查提交日志,如下命令所示:

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

    define two var 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 <[email protected]>
Date:   Fri Jul 7 16:55:12 2017 +0800

    Initial commit

下面我們打開文件:main.py 加入以下兩行:

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

更正操作提交新的更改,并查看提交日志。首先查看狀態,如下命令:

$ git status
On branch master
Your branch is ahead of 'origin/master' by 4 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")

添加文件并查看狀態,如下命令:

$ git add main.py

Administrator@MY-PC /D/worksp/sample (master)
$ git status
On branch master
Your branch is ahead of 'origin/master' by 4 commits.
  (use "git push" to publish your local commits)

Changes to be committed:
  (use "git reset HEAD ..." to unstage)

        modified:   main.py

提交更改的文件,如下所示:

$ git commit --amend -m "add the sum of a & b "
[master 51de0f0] add the sum of a & b
 1 file changed, 5 insertions(+), 1 deletion(-)

現在,使用 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 <[email protected]>
Date:   Fri Jul 7 16:55:12 2017 +0800

    Initial commit

 

全部教程
主站蜘蛛池模板: 天天干天天色天天射 | 亚洲精品亚洲人成在线播放 | 亚洲欧美另类专区 | 老色鬼a∨在线视频在线观看 | 湿湿影院在线观看 | 日韩一区二区三区四区 | 亚洲欧美日韩中文字幕在线 | 色四月| 91视频你懂的 | 九九99视频在线观看视频观看 | 伊人中文字幕在线观看 | 视色视频在线 | 狠狠狠狠狠狠狠狠 | 亚洲精品免费在线 | 久久伦理影院 | 成人毛片在线播放 | 拍真实国产伦偷精品 | 日本人一级毛片免费视频 | 99久久精品6在线播放 | 国产亚洲美女精品久久久2020 | 国产激情视频在线观看首页 | 精品国免费一区二区三区 | 七次郎在线视频精品视频 | 玖玖在线视频 | 日日夜夜操天天干 | 久久精品国产亚洲香蕉 | 亚洲小视频 | 亚洲欧洲久久久精品 | 欧美日韩精品高清一区二区 | 韩国女主播一区二区三区视频 | 精品国产精品国产 | 五月婷婷综合在线视频 | 日韩一级黄色大片 | 国产香蕉网 | 日韩精品一区二区三区高清 | 性欧美欧美之巨大69 | 国产欧美亚洲精品第二区首页 | 久久天天躁狠狠躁夜夜躁综合 | 狠狠操天天 | 欧美激情在线 | 国产伦精品一区二区三区免费观看 |