git工具使用
2016-01-31 15:50
417 查看
1.从github克隆代码,在本地使用:
git clone http://github.com/Weltch/helloworld.git
2.拉取github代码到本地修改,并提交(第一次建立git仓库);
a) 新建空目录tmp;
b) cd tmp;
c) 建立git仓库,git init;
d) 拉取远程代码: git pull http://github.com/Weltch/helloworld.git
e) 添加文件:git add 文件名或文件名
f) 确认提交: git commit -m “注释说明”
g) 向github添加分支:git remote add origin http://github.com/Weltch/helloworld.git
(提示:如果报错fatal: remote origin already exists,则先删掉origin分支,再提交。删除分支:git remote rm origin)
h) 提交分支到远程仓库:git push -u origin master
3. 更新代码(已经建立git仓库);
a)首先确定git仓库是否最新,拉取一遍:git pull即可;
b) 添加修改过的文件: git add 文件
c) 确认提交:git commit -m “add 文件”
d) 直接提交到远程仓库:git push -u origin master
4. 添加新分支到远程仓库
a) 在本地创建并切换到新分支:git checkout -b newbranch;
b) 将修改后的文件添加到该分支,git add *; git commit -m “*”;
c) 查看远程有没有newbranch分支:git branch -r;
d) 如果没有则提交到远程git仓库:git push origin newbranch;这时在远程就会生成newbranch的分支;
git clone http://github.com/Weltch/helloworld.git
2.拉取github代码到本地修改,并提交(第一次建立git仓库);
a) 新建空目录tmp;
b) cd tmp;
c) 建立git仓库,git init;
d) 拉取远程代码: git pull http://github.com/Weltch/helloworld.git
e) 添加文件:git add 文件名或文件名
f) 确认提交: git commit -m “注释说明”
g) 向github添加分支:git remote add origin http://github.com/Weltch/helloworld.git
(提示:如果报错fatal: remote origin already exists,则先删掉origin分支,再提交。删除分支:git remote rm origin)
h) 提交分支到远程仓库:git push -u origin master
3. 更新代码(已经建立git仓库);
a)首先确定git仓库是否最新,拉取一遍:git pull即可;
b) 添加修改过的文件: git add 文件
c) 确认提交:git commit -m “add 文件”
d) 直接提交到远程仓库:git push -u origin master
4. 添加新分支到远程仓库
a) 在本地创建并切换到新分支:git checkout -b newbranch;
b) 将修改后的文件添加到该分支,git add *; git commit -m “*”;
c) 查看远程有没有newbranch分支:git branch -r;
d) 如果没有则提交到远程git仓库:git push origin newbranch;这时在远程就会生成newbranch的分支;
相关文章推荐
- RPC failed; result=22, HTTP code = 411
- 查看github pages文档的方式
- 使用BAE的基于Web.py的简单博客程序
- git更新已經刪除的文件
- 提取Git每次提交后Commit的文件
- GIT迁移服务器
- 分布式版本管理git入门指南使用资料汇总及文章推荐
- git终极指南:在实际开发中的应用
- 两分钟学会如何在github托管代码
- Git远程操作详解
- 25个 Git 进阶技巧(翻译)
- 详解版本控制利器Git,SVN的异同以及适用范围
- Android自定义View实现仿GitHub的提交活跃表格
- Ruby实现的删除已经合并的git分支脚本分享
- 在 Shell 提示符中显示 Git 分支名称的方法
- Git使用基础篇(一些常用命令和原理)
- git fork同步是什么意思?
- github配置使用指南
- github版本库使用详细图文教程(命令行及图形界面版)