zoukankan      html  css  js  c++  java
  • 第三章读书笔记

    第三章

    Git作用是对源代码进行管理。

    Linux下可以直接使用man命令查看指定命令的帮助文档 #man git-checkout

    基本用法

    1,创建版本库:git init

    Git版本库分为本地版本库和远程版本库。

    #mkdir -p /demo/helloworld-git

    #cd /demo/helloworld-git

    #git init

    #ls -al(建立空的版本库)

    2,将文件提交到本地版本库:git commit

    /demo/helloworld-git目录下建立helloworld.txt文件

    #cd /demo/helloworld-git

    #echo “helloworld” > helloworld.txt

    将文件加到本地版本库的索引中,并将helloworld.txt文件提交到版本库

    #git add helloworld.txt

    #git commit -m ‘helloworld-master’

    (提交完成后就不怕源代码误删或误改了)

    恢复到最近一次提交的状态:

    #git checkout helloworld.txt

    3,创建本地分支:git branch

    显示分支:# git branch

    建立分支:# git branch new-branch

    4,切换本地分支:git checkout

    切换分支:# git checkout new-branch

    使用git checkout master 和 git checkout new-branch来回切换本地版本库。

    5,在GitHub上创建开源项目

    6,上传源代码到GitHubgit push

    需要在~/.ssh目录中生成一个密钥文件(id_rsa)和一个公钥文件(id_rsa.pub

    # ssh-keygen -t rsa -C ”helloworld@126.com”

    7,从GitHub下载源代码:git clone

    Linux内核完全是使用Git管理的。

     http://www.cnblogs.com/875825a/

  • 相关阅读:
    Lucene底层原理和优化经验分享(1)-Lucene简介和索引原理
    mysql 索引
    C++ 后台进程 daemon
    Linux进程状态
    实现一个简单的shared_ptr
    [LeetCode] Factorial Trailing Zeroes
    完美转发
    排序
    每天五个java相关面试题(7)--线程篇
    程序员为什么会淡忘?
  • 原文地址:https://www.cnblogs.com/875825a/p/5412316.html
Copyright © 2011-2022 走看看