Git使用

GitHub python

   GitHub是一個用於版本控制協做代碼託管平臺git

   GitHub官網地址—https://github.com/yangzhizong/-/branchegithub

GITvim

  官網安裝地址:https://www.git-scm.com/downloads spa

 

第一步git init (完成初始化)版本控制

在當前項目工程下履行這個號令,至關於把當前項目git化code

在當前項目的目錄中生成本地的git管理(咱們會發現當前目錄下多了一個.git文件夾)blog

#先要切換到你指定的本地目錄
yaodong.hou@L-002627 MINGW64 /d
$ cd python

yaodong.hou@L-002627 MINGW64 /d/python
$ cd git_use

yaodong.hou@L-002627 MINGW64 /d/python/git_use
$ ^C

yaodong.hou@L-002627 MINGW64 /d/python/git_use
$ git init
Initialized empty Git repository in D:/python/git_use/.git/

yaodong.hou@L-002627 MINGW64 /d/python/git_use (master)
$

運行完畢後,後在你指定的目錄裏面出現一個隱藏的 .git文件夾it

 

經常使用命令ast

pwd查看當前所在目錄

yaodong.hou@L-002627 MINGW64 /d/python/git_use (master)
$ pwd /d/python/git_use

ls查看當前目錄文件

ls -al顯示隱藏文件

yaodong.hou@L-002627 MINGW64 /d/python/git_use (master)
$ ls
time1212.py


第二步vim新建一個py文件驗證提交到倉庫,也能夠用

新建一個文件(驗證提交到倉庫操做)
yaodong.hou@L-002627 MINGW64 /d/python/git_use (master)
$ vim time1212.py

status查看狀態(Untracked顯示git還未跟蹤)

yaodong.hou@L-002627 MINGW64 /d/python/git_use (master)
$ git status On branch master

No commits yet

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        time1212.py

nothing added to commit but untracked files present (use "git add" to track)

yaodong.hou@L-002627 MINGW64 /d/python/git_use (master)
$

 

第三步git add + 文件名,把內容從工做區提交到暫存區

注意:暫存區也是在本地

yaodong.hou@L-002627 MINGW64 /d/python/git_use (master)
$ git add time1212.py
warning: LF will be replaced by CRLF in time1212.py.
The file will have its original line endings in your working directory

status再次查看狀態 (狀態變爲等待被提交

yaodong.hou@L-002627 MINGW64 /d/python/git_use (master)
$ git status On branch master

No commits yet

Changes to be committed: #等待被提交 (use "git rm --cached <file>..." to unstage) 
        new file:   time1212.py

 

第四步:commit提交文件到倉庫,git commit time1212.py -m "註釋文件"

 

待完善。。

相關文章
相關標籤/搜索