Git 使用常用命令

  使用简单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分支继续开发

猜你喜欢

转载自www.cnblogs.com/dztHome/p/9429508.html
今日推荐