Git 使用常用命令
阿新 • • 發佈:2018-08-06
命令控制 創建 git pull 項目 mark init eve git add evel
使用簡單Git命令控制代碼版本。
(註:[]中的只需首次輸入)
新項目
git init #初始化本地git倉庫
git remote add origin http://git.itwecard.com/dingziting/test.git #關聯遠程倉庫地址
常用
git pull #從線上獲取代碼
git add . # 添加到待提交緩存
git commit -m "Initial commit" # 提交至本地倉庫
git push [-u origin master] # 上傳至線上倉庫
分支管理 : 默認master(生產)分支
git checkout [-b] branchname # 創建[並進入該分支]
...正常寫代碼
git add . # 添加到待提交緩存
git commit -m "Initial commit" # 提交至本地倉庫
git push [-u origin master] # 上傳至線上倉庫
合並分支 例如:develop分支需合並入master分支
git pull
git add .
git commit -m ‘remark‘
git push
git checkout master # 進入master
git merge --no-ff develop # 合並develop分支
git push # 提交遠程倉庫
git checkout develop # 進入develop分支繼續開發
Git 使用常用命令