[新手 git ] git 基本指令


Posted by tzutzu858 on 2020-06-21

Git 是版本控制系統,為什麼要做版本控制,因為開發程式和系統過程會不斷重覆設計和修改。

  • git init
    在指定資料夾下按git init就可以對指定資料夾做版本控制

  • git status
    查看版本狀態

  • git rm -- cached <file>
    移除版本控制

  • git add .
    把所有檔案都加入版本控制

  • git commit -m "自己寫敘述"
    用來作版控的敘述

  • git log
    歷史紀錄

    P.S.如果有改檔案,都要先git add <改過的檔案>
    然後再git commit -m "自己寫敘述"

    更方便的方法:
    原本要先git add .git commit -m "自己寫敘述"
    可以直接用git commit -am "自己寫敘述"
    a是all的意思
    但是如果有新檔案用git commit -am "自己寫敘述"並不會把新的檔案commit進來
    還是要先git add .git commit

  • git log --oneline 顯示比較簡短的log

  • git checkout <A版本名稱> 回到A版本

  • git checkout master 回到最新的狀態

  • git diff可以看出在commit之前改了什麼東西,按q可以出來

  • .gitignore 版控裡想要忽略的檔案(意思是不讓特定檔案版控)
    作法:
    touch .gitignore
    vim .gitignore 把不要版控的檔案寫入


#Git







Related Posts

[MTR04] W2 D9 String 類型的內建函式

[MTR04] W2 D9 String 類型的內建函式

簡明程式解題入門 - 字串篇 III

簡明程式解題入門 - 字串篇 III

[Power BI] Data Cleansing #1

[Power BI] Data Cleansing #1


Comments