前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >git 版本管理工具说明

git 版本管理工具说明

作者头像
小蔚
发布2019-09-11 17:45:38
7630
发布2019-09-11 17:45:38
举报
文章被收录于专栏:小蔚记录小蔚记录
  1. $ git init    (初始化本地仓库,会生成.git 文件夹 .git 文件夹里存储了所有的版本信息、标记等内容)
  2. $ git add .    (从本地仓库增删,结果将会保存到本机的缓存里面)
  3. $ git commit -m " 第 次提交 "   (提交,把本机缓存中的内容提交到本机的 HEAD 里面)
  4. $ git remote add origin http:\\....... (把本地仓库和远程仓库关联起来。如果不执行这个命令的话,每次 push 的时候都需要指定远程服务器的地址)
  5. $ git push origin master (把本地master分支的最新修改推送至远端 (如GitHub))
  6. $ git pull origin master    (将远端仓库pull最新代码)
  7. 如果出错:git pull --rebase origin master
代码语言:javascript
复制
Username for 'https://github.com': yjlgithup
To https://github.com/yjlgithup/bu.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/yjlgithup/bu.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

提交代码到远程分支

1.git checkout -b ' two ' (切换并创建一个分支)

  2.git add .    (提交分支代码)

  3.git commit -m '' (提交 修改信息)

  4.git remote add origin http://.... (连接远程仓库)

  5.git pull origin master (重新拉一边代码)

  6.git push origin two (提交分支代码)

githup 上面会出现你心创建的分支,并且提交的代码

拉取分支代码到本地

当我想从远程拉取到一条本地不存在的分支 代码

  1.git init (初始化)

  2.git remote add origin http://.... (连接远程仓库)

  3.git clone (首次拉取代码)

  4.git pull origin master

  5.git fetch

  6.git checkout -b (本地分支名称 two )origin/(远程分支名称 two)

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2017-11-15 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档