Android驱动开发第三章

第三章主要讲了git的使用入门,Git是目前世界上最先进的分布式版本控制系统。 

    使用git之前首先应该安装git,Ubuntu Linux版本中安装git的指令        

  1、# apt-get install git
  2、# apt-get install git-doc git-svn git-email git-gui gitk 

   在使用man命令查看指定帮助文档

      1、查询git-checkout 命令的帮助文档,使用命令:# man git-checkout 
  2、查询git-checkout 命令的文档,使用命令:# git help git-checkout
  3、查询HTML格式的git-checkout 命令的文档,使用命令:# git help -w git-checkout                                      

   创建版本库   git int           

      1.建立一个开源项目的工作目录,并进入工作目录 
  # mkdir -p /demo/helloworld-git
  # cd  /demo/helloworld-git
  2.执行命令
  # git init
  2、将文件提交到本地版本库:git commit
  1.进入/demo/helloworld-git 目录,并建立一个helloworld.txt文件
  # cd /demo/helloworld-git
  # echo “helloworld”>helloworld.txt
  2.执行命令将helloworld.txt文件加到本地版本库的索引中,并将helloworld.txt文件提交到版本库
  # git add helloworld.txt
  # git commit -m ‘helloworld-master’
  3.显示日志记录
  # git log
  恢复文件
  # git checkout helloworld.txt
  3、创建本地分支:git branch
  另外Git鼓励大量使用分支:

  查看分支:git branch

  创建分支:git branch <name>

  切换分支:git checkout <name>

  创建+切换分支:git checkout -b <name>

  合并某分支到当前分支:git merge <name>

  删除分支:git branch -d <name>

 

原文地址:https://www.cnblogs.com/gy1233/p/5436560.html