zoukankan      html  css  js  c++  java
  • 使用git管理代码的心得

    一、简易使用流程
    首先下载安装git,点击Git Bash进入编辑界面,之后如下图进入目录并通过命令 git init 把这个目录变成git可以管理的仓库

    接下来使用git add .命令将所有文件添加到本地repository和git commit -m "msg"命令将变动提交到本地repository

    连接github上的远程仓库

    注意:http...是自己在github上仓库的地址;第一次使用git push origin master需要加上 -u
    连接远程仓库需要建立ssh key,由于步骤较长所以直接贴网站:http://www.xuanfengge.com/using-ssh-key-link-github-photo-tour.html

    上传成功后:

    二、遇到的问题
    1、

    解决方法:删掉.git文件

    并如上图,之后重新git init......

    2、错误提示类似于:
    $ git push -u origin master
    To git@github.com:/Demo.git
    ! [rejected] master -> master (non-fast-forward)
    error: failed to push some refs to 'git@github.com:
    /Demo.git'
    hint: Updates were rejected because the tip of your current branch is behind
    hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
    hint: before pushing again.
    hint: See the 'Note about fast-forwards' in 'git push --help' for details.

    详细解决方法地址:http://www.douban.com/note/332510501/

    三、心得体会
    先说明一下,我被github网站气得要死,也不知道是什么问题我要不是连不上就是随便点个按键都要刷新很久,后来关掉电脑管家设置代理服务器在hosts里面修改只是稍好了一点。。。
    真正的心得:
    1、fork功能可以很好地学习应用别人的代码
    2、当你把某些文件全删掉之后还可以恢复,可以避免不必要的损失
    3、git的分支功能挺实用的
    本次项目代码上传github代码库地址: https://github.com/spy-bear/spy-code

    更多新手关于git的使用:http://blog.jobbole.com/78960/

  • 相关阅读:
    0719PHP基础:PDO
    0717PHP基础:面向对象
    0716PHP基础:面向对象
    0715JS基础:ajax
    0715PHP练习:文件操作
    0715PHP基础:文件操作
    0629正则表达式:基础
    0628正则表达式:练习
    zTree简单使用和代码结构
    servlet
  • 原文地址:https://www.cnblogs.com/superspy/p/4824108.html
Copyright © 2011-2022 走看看