zoukankan      html  css  js  c++  java
  • git2

    必须工作区有变动,每次只做一个就可以

    git stash

    git stash list 查看stash

    git stash drop 删除快照

    git stash pop 恢复快照并删除快照 = git stash apply + git stash drop

    git stash apply stashid 恢复快照

    分支

    • 合并的时候不能太长 一般2-3
    • 完成一个小功能合并一次
    • 合并的时候所有人都要在

    git branch 查看分支

    git branch name 新建分支

    git checkout name 切换分支

    git branch -d name 删除分支

    git merge name 在合并到的分支上合并

    git checkout -b name 创建分支并切换分支=git branch name +git chekcout name

    你们公司里面有几个分支?

    • master
    • dev
    • review
    • 一个人一个分支

    review 分支? 谁?

    • 主管
    • 带你的人

    review分支view什么?代码的逻辑 还是代码的规范?

    远程仓库

    • github
    • 码云
    • gitlab

    问题

    error: failed to push some refs to 'https://github.com/417685417/s20.git'
    hint: Updates were rejected because the remote contains work that you do
    hint: not have locally. This is usually caused by another repository pushing
    hint: to the same ref. You may want to first integrate the remote changes
    hint: (e.g., 'git pull ...') before pushing again.
    hint: See the 'Note about fast-forwards' in 'git push --help' for details.
    
    

    解决办法

    git pull

    git clone 将远程仓库的代码拉取到本地,默认是master

    git push origin master 上传

    git pull origin dev 下载

    解决只有master,没有dev:
    git checkout -b dev origin/dev 以远程仓库的dev分支为模板创建本地dev分支= git branch dev origin/dev + git checkout dev

    git push origin --delete dev1

    开发完,(第六次)忘了push,

    又pull下来,开发了第七次,

    解决方法: 先pull (这里更改冲突,然后git add. git commit -m ""), 后push

    git branch -d dev1 : 删除分支 线上还有
    Git push origin --delete dev1 : 线上也删除了

    问题2

    remote: Permission to songzhixue1993/zhihu.git denied to 417685417.
    fatal: unable to access 'https://github.com/songzhixue1993/zhihu.git/': The requested URL returned error: 403
    
    • 添加成合作者(协作者)
    • 创建一个组织
    • 给别人贡献代码
      • fork
      • 修改
      • 上传到自己的远程仓库
      • new pull request
      • 会merge一下

    tag

    实现如django版本管理类的东西

    1.11 2.0 2.1

    • 完成一个里程碑式的功能

    git tag 查看标签
    git tag -a name -m “” 创建一个tag

    git tag -a name -m "" hash 以hash为模板创建一个tag

    git tag -d name 删除一个本地的tag git push origin --tags

    git tag -d v0.5 #删除本地

    git push origin :refs/tags/name 删除远程仓库的tag

    git push origin :refs/tags/v0.5 #往上推送一个空的=删除远程

    忽略文件

    .gitignore 文件

    git rm -r --cached .
    git add .
    git commit -m ``'update .gitignore'
    

    正则

    rebase

    变基 将提交记录变成一条直线

    重新设置用户

    git config unset user.name

    git config unset user.email

    git config --global user.name 'xiaohei'

    git config --global user.email '123@qq.com'

    作业:

    1 . git

    2 . 不下50个 可以pycharm的图形化

    3 .

    4 . 通过分支

    ​ stase 自己开发

    5 . 建立一个review分值,不定期的迭代代码

    6 .

    9 . 共有和私有, 部署在自己的环境里

    10 .fork new pull request

    11 .忽略文件, 可以使用Python

  • 相关阅读:
    数据结构-向量
    可信执行环境(TEE)介绍 与应用
    ACM
    带哨兵节点和不带哨兵节点的单链表操作的对比
    java:Conllection(List,set,get,map,subList)使用
    java:在Conllection接口中实际上也规定了两个可以将集合变成对象数组的操作
    java:Conllection中的List,ArrayList添加元素,删除元素,输出元素
    java:类集框架conllection接口list,set
    java:投个票程序
    git:Git fetch和git pull的区别, 解决Git报错:error: You have not concluded your merge (MERGE_HEAD exists).
  • 原文地址:https://www.cnblogs.com/Doner/p/11456174.html
Copyright © 2011-2022 走看看