码迷,mamicode.com
首页 > 其他好文 > 详细

git常用命令

时间:2016-09-22 23:47:39      阅读:176      评论:0      收藏:0      [点我收藏+]

标签:

添加已有项目到github/更新代码 

添加已有项目到github

新建repository,可以在github网站上直接新建或者使用windows github工具。

进入github repository 项目

 

在github windows工具中使用Git Bash打开项目,使用cd命令进入已有项目根目录下

 

touch README.md //新建说明文件
git init //在当前项目目录中生成本地git管理,并建立一个隐藏.git目录
git add . //添加当前目录中的所有文件到索引
git commit -m "first commit" //提交到本地源码库,并附加提交注释
git remote add origin https://github.com/chape/test.git //添加到远程项目,别名为origin
git push -u origin master //把本地源码库push到github 别名为origin的远程项目中,确认提交

提交完成,查看repository。

 

更新代码

cd /d/TVCloud
git add .
git commit -m "update test" //检测文件改动并附加提交注释
git push -u origin master //提交修改到项目主线

 

github常用命令

git push origin master //把本地源码库push到Github上
git pull origin master //从Github上pull到本地源码库
git config --list //查看配置信息
git status //查看项目状态信息
git branch //查看项目分支
git checkout -b host//添加一个名为host的分支
git checkout master //切换到主干
git merge host //合并分支host到主干
git branch -d host //删除分支host

git常用命令

标签:

原文地址:http://www.cnblogs.com/chuange-Strongload/p/5898226.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!