$ git init

這個命令會建立名為 .git 的子目錄,該目錄包含一個Git儲存庫架構必要的所有檔案。


複製並下載遠端數據庫

$ git add README
將README加入Stage。

$ git reset HEAD README
將README從Stage中移除。

$ git commit -m “First update”
提交。這個指令的提交還在本地端,所以可以修改commit logs。

$ git commit —amend
帶入文字編輯器,修改上一次的commit訊息。

$ git branch
列出所有本地端的分支。

$ git branch -r
列出所有遠端的分支。

$ git branch -a
列出所有本地及遠端的分支。

$ git branch <branch_name>
建立一個新的分支名為branch_name。

$ git branch -d <branch_name>
刪除分支。

$ git tag <tag_name>
在HEAD指向的提交裡添加標籤名為tag_name。

$ git tag -am “Comment” <tag_name>
在HEAD指向的提交裡添加標籤名為tag_name並添加註解。

$ git tag
顯示標籤的列表。

$ git tag -n
顯示標籤的列表和註解。

$ git tag -d <tag_name>
刪除標籤。

$ git log --decorate
顯示包含標籤資料的歷史記錄。

$ git remote add <short_name> <remote_URL>
加入一個遠端儲存庫,將欲新增的遠端儲存庫取一個簡短的名字。

$ git remote -v
列出當初加入的遠端儲存庫時指定的名稱及其URL。

$ git push -u origin master
上傳到<remote_name>遠端資料庫的<branch_name>分支。

$ git push
上傳到遠端資料庫

$ git fetch origin
將<remote_name>遠端儲存庫的資料拉到本地端的儲存庫,但未自動合併。

$ git pull
將遠端儲存庫的資料拉到本地端的儲存庫,並自動合併,相當於git fetch + git merge。

$ git status
列出所在分支及尚未commit的明細。

$ git checkout
只列出尚未commit的明細。

$ git checkout <branch_name>
切換到另一個分支。

$ git checkout -b <branch_name>
建立一個新的分支名為branch_name並切換到該分支。

arrow
arrow

    viaLondon 發表在 痞客邦 留言(0) 人氣()