zoukankan      html  css  js  c++  java
  • git代码版本管理

     1.  Set Up Git

    $ git config --global user.name "Your Name Here"
    $ git config --global user.email "your_email@example.com"
    $ git config --global credential.helper cache  # timeout=900 by default
    $ git config --global credential.helper 'cache --timeout=3600'

     2. Create A Repo

    •   Make a new repository on GitHub

         Click New Repository

    •   Create a README for your repository

         Step 1: Create the README file      

    $ mkdir ~/Hello-World
    $ cd ~/Hello-World
    $ git init
    $ touch README
    

           Step 2: Commit your README

    $ git add README
    $ git commit -m 'first commit(your description)'      
    # git add <filename>
    # git add <folder>
    # git add -u # 只加修改过的文件,不加入新增文件
    # git add -i # 进入交互模式i
    
    # git rm <filename>
    # git mv <filename> <newfilename>
    # git mv <folder> <newfolder>
    

           Step 3: Push your commit

    $ git remote add origin https://github.com/username/Hello-World.git
    $ git push origin master
    

     附:

    error: RPC failed; result=56, HTTP code = 0
    refer here
    $ git config http.postBuffer 524288000 
    

     参考:

    官网:https://help.github.com/articles/set-up-git

    其他链接:http://rogerdudler.github.io/git-guide/index.zh.html    

    因为经常把工作带回家去做,在家用电脑上写的一些代码常常来不及与公司电脑上的代码进行同步,导致代码管理混乱。

    现在使用git来进行源代码管理,就轻松多了,而且还可以很方便地和别人一起协作开发。
    1. 将PC-1上现有的Hello-World进行git管理并上传到服务器端:

      cd ~/Hello-World
      git init
      git add *
      git commit -m 'initial commit'
      git remote add origin https://github.com/username/Hello-World.git          
      git push origin master        #将本地的代码上传到服务器端

    2. 从服务器端检出版本库到PC-2,在PC-2上新建文件并上传到服务器端:

      git clonehttps://github.com/username/Hello-World.git Hello-World
      cd Hello-World

    i) add new file
      touch newfile         #创建一个新文件来做测试
      git add newfile
      git commit -m 'add newfile'
      git push origin master        #将本地的代码上传到服务器端

    ii) modify file

     # modify the files, then

     git checkout

     git add <file>

     git commit -m 'modify the file'

     git push origin master

    3.在PC-1上获取PC-2更新的内容:

      git pull origin master        #将服务器端的代码下载到本地  

  • 相关阅读:
    hdu 4504(背包最优方案数)
    hdu 4508(完全背包)
    hdu 4509(memset标记)
    hdu 2188
    hdu 2141(二分)
    《算术探索》(高斯) 第一篇(第112目) 总结
    数论概论(Joseph H.Silverman) 定理39.1 连分数的递归公式
    数论概论(Joseph H.Silverman) 定理39.2 连分数相邻收敛项之差定理
    《算术探索》(高斯) 第一篇(第112目) 总结
    有理数的小数表示若无限,则必为无限循环的
  • 原文地址:https://www.cnblogs.com/Amagasaki/p/3620286.html
Copyright © 2011-2022 走看看