• github


    ❶svn 与 git 区别:
      svn 集合在一个中央服务器中 有风险 (集成式 )
      git 每台电脑都是一样的版本控制,( 分布式)

    ❷github 网站属于中转站, 远程仓库

    ❸三个区 :

      工作区

      暂存区
        svn没有这个概念
        通过暂存区把工作区的内容提交到版本区
        1.作为过渡层
        2.避免误操作
        3.保护工作区和版本区
        4.分支处理
      版本区(库)
        master主分支

    ❹git命令
      git init
      git config --list 所有配置
      git status 查找状态
      git add 添加到暂存区 git add . 所有的
      git commit 暂存区放到版本区 -m "change"
      git commit -a(简写add) -m "add change"
      git log 查看历史
      对比
        git diff 工作区与暂存区之间的对比
        git diff --cached(--staged) 暂存区与版本库之间的对比
        git diff master 工作区与版本区之间的对比
      撤消命令
        git reset HEAD file.name 从暂存区到工作区
        git checkout --file.name 回到工作区
        git commit --amend (误提交) 撤消上一次的提交,重新提交
      删除
        git rm file.name 当工作区的文件删除的时候,暂存区的文件删除
        git rm -f file.name 工作区和暂存区都有的情况下,删除所有
        git rm --cached file.name 工作区和暂存区都有的情况下,保留工作区的文件、删除暂存区的文件
      恢复
        git checkout commit id ( git log ) file.name 恢复工作区文件 指定文件恢复
        git reset --hard commit id 恢复到版本 指定版本恢复
        gut reset --hard HEAD^ 上一个版本
        gut reset --hard HEAD~num 上num版本
        git reflog 回到未来和过去 找到所有的版本
      同步到远程仓库
        git remote 远程默认名字
        git remote add 可以改名字
        git remote -v 查看地址
        git push 默认名字origin master
      多人协作解决冲突
        git fetch 先查看区别、冲突, 在手动改
        git diff master origin/master
        git merge origin/master
        git pull 查看不了区别
      分支
        git branch 查看当前分支
        git branch new 创建新的分支
        git checkout new 切换分支
        git checkout -b new2 快速切换
        git merge new2 合并 (冲突的时候通过git status查看 手动处理)
        git branch --merged 当前分支的合并分支
        git branch --no-merged 没有合并的分支
        git branch -d 删除当前分支的合并分支
        git branch -D 删除没有合并的分支

        git push origin 分支名字 (把分支提交到github)
        github上的标签
        git tag 标签名
        git push origin 标签名

    ❺开源项目协作 (github上操作)
      fork
      pull request

  • 相关阅读:
    ng -v 不是内部或外部命令
    更改package.js后重新加载
    表格添加滚动条
    eclispse指针变成十字型
    清除输入框缓存数据
    用cd 命令进入和退出D盘文件夹的操作步骤。
    npm ERR! cb() never called! npm ERR! This is an error with npm itself. Pleas
    离开电脑时锁定电脑
    slice
    golang之字符串
  • 原文地址:https://www.cnblogs.com/xiaozhishang/p/4769724.html
Copyright © 2020-2023  润新知