git常用命令

2022-07-29 08:54:13 字數 938 閱讀 9186

git init  新建倉庫

git clone 轉殖遠端倉庫

git clone username@host:/path/to/repository  轉殖到遠端倉庫

git add 新增檔案到快取區

git add *  將所有改動檔案新增到快取區

git commit -m "**提交資訊"

git push origin master 將**提交到遠端伺服器主分支上

git remot add origin 將本地倉庫鏈結到某個遠端倉庫上

git checkout -b name  建立分支並切換到該分支上

git checkout master    切換回主分支

git branch -d name     刪除分支

git push origin

將新建的分支推到遠端倉庫上

git pull/fetch   拉取遠端改動**

git merge

將某個分支合併到當前分支上

git diff 檢視合併之前的改動

git add 標記衝突檔案合併成功

git log  獲取提交的id

git tab 1.0.0.1 提交id   新增標籤

git checkout  -- 使用遠端倉庫中的檔案替換掉你工作目錄的檔案

git fetch origin     獲取最新的版本

git reset --hard origin/master    將本地分支只想剛來回的新版本呢   丟棄所有本地改動與提交時使用

gitk  內建的圖形化介面

git config color.ui true   彩色的git輸出

git config format.pretty oneline  顯示歷史記錄時,只顯示一行注釋資訊

git add -i 互動的新增檔案至快取區     

常用命令 Git 常用命令大全

安裝教程可參照 廖雪峰老師的安裝教程。git config 在git中,使用git config 命令來配置 git 的配置檔案,git配置級別主要有3類 1 倉庫級別 local 本地 git 倉庫級別配置檔案,作用於當前倉庫。優先順序最高 2 使用者級別 global,全域性配置檔案,作用於所有...

git 常用命令

檢視是否存在檔案需要上傳 git status git add git commit m 建立遠端倉庫 git remote add origin 116.255.146.153 ruby cd work daily project.git 更新git fetch 116.255.146.153 r...

git常用命令

詳細 1,git log p 命令來顯示每一次提交與其父節點提交內容之間快照的差異。2,為了檢視載入 staged 而並未提交 not committed 的內容差異,可以使用 git diff stage 命令 在git 1.6之前的版本中,使用 cached 適應情形 在執行git commit...