zoukankan      html  css  js  c++  java
  • 新手用git

      最近几天用到了git,作为只看过教程,没有在实际项目中使用过的人来说,简直是 T_T ......

      在这里记录一下,以防以后忘记。

    1. clone : 本地没有该库,从远程repository拷贝到本地
    2. fetch : 本地有该库,将远程repository的新commit下载到本地
    3. pull : fetch + merge 操作,分开操作更安全
    4. 提交新的变更,一般的步骤是:
      > git add .
      > git commit -m "new commit"
      > git push
    5. 同步fork项目原作者的改动:
      // 查看fork库的地址和原作者库的地址
      git remote -v
      // 获取原作者最新版本
      git fetch upstream
      // 如果当前不是master,切换到master
      git checkout master
      // 合并
      git merge upstream/master
    6. 遇到的几个问题:
      1. fatal: LF would be replaced by CRLF / fatal: LF would be replaced by CRLF http://blog.csdn.net/lysc_forever/article/details/42835203
      2. fatal: No remote repository specified. Please, specify either a URL or a remote name from which new revisions should be fetched. : 可能是由于 .git/config 中配置不当,搜到了这篇文章(http://www.myexception.cn/operating-system/1470149.html),笔者贴上了一个模板,如下:

        [core]
            repositoryformatversion = 0
            filemode = true
            bare = false
            logallrefupdates = true
            ignorecase = true
            precomposeunicode = false
        [remote "origin"]
            url = https://github.com/CrossLee/xxx.git
            fetch = +refs/heads/*:refs/remotes/origin/*
            pushurl = https://github.com/CrossLee/xxx.git
        [branch "master"]
            remote = origin
            merge = refs/heads/master

        其中 url pushurl 换成自己的项目地址。

  • 相关阅读:
    ajaxfileupload.js类实现异步文件上传
    设计模式代理
    状态码的分析
    图片的格式的分析、 图片优化
    BFC
    css3 的新属性
    二列布局、三列布局总结
    position的定义
    new Vue 发生了什么
    数据驱动
  • 原文地址:https://www.cnblogs.com/noteit/p/5255769.html
Copyright © 2011-2022 走看看