Git&GitHun 命令合集
阿新 • • 發佈:2018-09-19
com email message 系統用戶 日誌 git add etc 版本信息 操作系統
Git&GitHun 命令合集
基本操作
- git --version 查看git版本信息
- git add 本地庫初始化
設置簽名
- git config user.name xxx
- git config user.email [email protected] 設置簽名(項目級別/倉庫級別:僅在當前本地庫範圍內有效)
- git config --global user.name xxx
git config --global user.email [email protected] 設置簽名(系統用戶級別:登錄當前操作系統的用戶範圍)
- git status 查看工作區、暫存區狀態
- git add [file name] 將工作區的“新建/修改”添加到暫存區
git commit -m "commit message" [file name] 將暫存區的內容提交到本
日誌查看
- git log 查看提交記錄
- git log --pretty=onelie
- git log --onelie
- git reflog
分支操作
- git branch [分支名] 創建分支
- git branch -v 查看分支
- git checkout [分支名] 切換分支
合並分支
- git checkout [被合並分支名] 切換到接受修改的分支(被合並,增加新內容)上
- git merge [有新內容分支名] 執行 merge 命令
遠程倉庫操作
- git remote -v 查看當前所有遠程地址
- git remote add 別名 遠程地址
- git push 別名 分支名
- git origin [遠程地址]
- git pull 遠程庫地址別名 遠程分支名
- git merge [遠程庫地址別名/遠程分支名]
- git fetch 遠程庫地址別名 遠程分支名
Git&GitHun 命令合集