• git,github初识命令


    内容回顾(django补充重要内容):

    1. django请求生命周期?
           MVC + 路由系统,一次请求,一次响应

      


    2. wsgi
      web服务网关接口,一套协议。
        实现wsgi协议的模块:
        wsgiref
        uwsgi
        werkzreg
    3. 路由系统
        /index/ index
        /index/(d+) index
        /index/(d+) index name='i1'

    4. 视图
        FBV,function Base View
        CBV,class base view

    5. orm(会)
      create
      delete
      update
      filter/all
      exclude
      values
      values_list
      get
      first
      last
      order_by
      only
      defer
      补充:
        # queryset = [obj,obj,obj]
        user_list = models.User.objects.all() # select id,name,pwd from user;
        for item in user_list:
        item.id
        tem.name

    # queryset = [obj,obj,obj]
      user_list = models.User.objects.all().only('id','name') # select id,name from user;
      for item in user_list:
        item.id
        item.name
        item.pwd

    # queryset = [obj,obj,obj]
      user_list = models.User.objects.all().defer('pwd') # select id,name from user;
      for item in user_list:
        item.id
        item.name



    # queryset = [{id:1,name:'xx'},obj,obj]
      user_list = models.User.objects.all().values('id','name')
      for item in user_list:
        item['id']
        item['name']
    6. 模板

    重点区域今日内容:git

    1. 版本管理工具
      - git
       - svn

      https://git-scm.com/downloads

    2. 大表哥创业故事:北京热

      a. 初次创建版本
        git init
        git config --global user.email "you@example.com"
        git config --global user.name "Your Name"


        git status
        git add .
        git commit -m "初次提交"
      b. 版本迭代
        git log
        git reflog

        git reset --hard 版本ID(就是后面类似于csrf一样的一串数字,返回那个位置,回滚)

      c. 开发新功能:附近的人

        git stash 将当前工作区所有修改过的内容存储到“某个地方”,将工作区还原到当前版本未修改过的状态
        git stash list 查看“某个地方”存储的所有记录
        git stash clear 清空“某个地方”
        git stash pop 将第一个记录从“某个地方”重新拿到工作区(可能有冲突)
        git stash apply 编号, 将指定编号记录从“某个地方”重新拿到工作区(可能有冲突)
        git stash drop 编号,删除指定编号的记录

    用于个人开发

      d. 分支
        git branch 查看所有分支
        git branch dev 创建分支
        git checkout dev 切换到分支
        git branch -d dev 删除分支

        git merge dev 合并分支,先在dev内修改好数据,然后git add . 然后 git commit -m "名称" 提交保存数据以后,去master,输入git merge dev,进行合并数据

      从此以后:
        - master
        - dev

        问题:你们在公司如果遇到要紧急修复的bug,怎么解决?
          在master分支上创建一个debug分支,在debug分支上进行修复,修复完毕后再合并到master并删除debug分支;
          再次切换会dev分支,进行开发....

      e. 代码仓库,
        个人:
        - github
        - 码云
        公司:
        - gitlab

        模拟情况:
        创建代码仓库:https://github.com/ayuchao/bjhot.git

        家里:
          git remote add origin https://用户名:密码@github.com/ayuchao/bjhot.git

          git push origin dev
          git push origin master

        公司:
          git clone https://用户名:密码@github.com/ayuchao/bjhot.git
          git branch dev
          git checkout dev
          git pull origin dev

        写代码
          git add .
          git commit -m 'xxx'
          git push origin dev

        家里:
          git pull origin dev
        写代码
          git add .
          git commit -m 'xxx'
          git push origin dev
        公司:
          git pull origin dev
        写代码
          git add .
          git commit -m 'xxx'
          git push origin dev



    总结:
        git做版本管理:本地
        github是代码托管仓库:远程


      1. 请书写你了解的git命令?
        准备:
          git init
          git config --global user.email "you@example.com"
          git config --global user.name "Your Name"
          git remote add origin https://github.com/ayuchao/bjhot.git
          git remote add origin https://用户名:密码@github.com/ayuchao/bjhot.git

        提交:
          git add .
          git commit -m 'xxxxx'
          git push origin dev

        下载:
          git clone https://github.com/ayuchao/bjhot.git

        等价于:
          1. 手动创建文件夹bjhot
          2. 进入文件夹
          3. git init
          4. git remote add origin https://用户名:密码@github.com/ayuchao/bjhot.git
          5. git pull origin master

          git pull origin master

        合并:
          git merge

        日志回滚:
          git log
          git reflog
          git reset --hard asdfasdfasdfadsfasdfasdf

        暂存:
          git stash
          git stash pop

        作业:
          1. 本地提交+回滚

          2. 通过分支来模拟:出现bug之后如何解决?
              master
              dev

          3. 将代码托管到github上

          4. 以后:将个人代码非敏感信息上传到github上。


























  • 相关阅读:
    Mysql 导入CSV数据 语句 导入时出现乱码的解决方案
    有用的 Mongo命令行 db.currentOp() db.collection.find().explain()
    MySql Host is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts' 解决方法 -摘自网络
    MongoDB索引相关文章-摘自网络
    批量更新MongoDB的列。
    RabbitMQ 消费端 Client CPU 100%的解决办法
    php根据命令行参数生成配置文件
    php解释命令行的参数
    使用memcache对wordpress优化,提速
    python基础技巧综合训练题2
  • 原文地址:https://www.cnblogs.com/zzw731862651/p/9320613.html
Copyright © 2020-2023  润新知