Git 常用命令速查

來源:互聯網
上載者:User

標籤:

git branch 查看本地所有分支
git status 查看目前狀態 
git commit 提交 
git branch -a 查看所有的分支
git branch -r 查看遠程所有分支
git commit -am "init" 提交並且加註釋 
git remote add origin [email protected]:ndshow
git push origin master 將檔案給推到伺服器上 
git remote show origin 顯示遠程庫origin裡的資源 
git push origin master:develop
git push origin master:hb-dev 將本地庫與伺服器上的庫進行關聯 
git checkout --track origin/dev 切換到遠程dev分支
git branch -D master develop 刪除本地庫develop
git checkout -b dev 建立一個新的本地分支dev
git merge origin/dev 將分支dev與當前分支進行合并
git checkout dev 切換到本地dev分支
git remote show 查看遠程庫
git add .
git rm 檔案名稱(包括路徑) 從git中刪除指定檔案
git clone git://github.com/schacon/grit.git 從伺服器上將代碼給拉下來
git config --list 看所有使用者
git ls-files 看已經被提交的
git rm [file name] 刪除一個檔案
git commit -a 提交當前repos的所有的改變
git add [file name] 添加一個檔案到git index
git commit -v 當你用-v參數的時候可以看commit的差異
git commit -m "This is the message describing the commit" 添加commit資訊
git commit -a -a是代表add,把所有的change加到git index裡然後再commit
git commit -a -v 一般提交命令
git log 看你commit的日誌
git diff 查看尚未暫存的更新
git rm a.a 移除檔案(從暫存區和工作區中刪除)
git rm --cached a.a 移除檔案(只從暫存區中刪除)
git commit -m "remove" 移除檔案(從Git中刪除)
git rm -f a.a 強行移除修改後檔案(從暫存區和工作區中刪除)
git diff --cached 或 $ git diff --staged 查看尚未提交的更新
git stash push 將檔案給push到一個臨時空間中
git stash pop 將檔案從臨時空間pop下來
---------------------------------------------------------
git remote add origin [email protected]:username/Hello-World.git
git push origin master 將本地項目給提交到伺服器中
-----------------------------------------------------------
git pull 本地與伺服器端同步處理
-----------------------------------------------------------------
git push (遠程倉庫名) (分支名) 將本地分支推送到伺服器上去。
git push origin serverfix:awesomebranch
------------------------------------------------------------------
git fetch 相當於是從遠程擷取最新版本到本地,不會自動merge
git commit -a -m "log_message" (-a是提交所有改動,-m是加入log資訊) 本地修改同步至伺服器端 :
git branch branch_0.1 master 從主分支master建立branch_0.1分支
git branch -m branch_0.1 branch_1.0 將branch_0.1重新命名為branch_1.0
git checkout branch_1.0/master 切換到branch_1.0/master分支
du -hs

git branch 刪除遠程branch
git push origin :branch_remote_name
git branch -r -d branch_remote_name

Git 常用命令速查

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.