zoukankan      html  css  js  c++  java
  • 第三章

    Git使用

    Git的目的是为了对源代码进行管理将代码转化为本Linux版本所需要的二进制。

    1、安装Git:一般Linux都自带Git,没有的话需要安装,#apt-get install git#apt-get install git-doc git-svn git-email git-gui gitk

    2、查看Git文档:#man git-checkout(按”q”键可退出帮助);查看指定文档#git help <sub-command>;查询git-checkout命令git help git-checkout;查看HTML格式文档#git help -w git-checkout

    3、Git例子:创建版本库a、建立并进入工作目录#mkdir -p /demo/helloworld-git#cd /demo/helloworld-gitb、创建本地版本库#git init #ls -al;提交文件到版本库:a、进入目录#cd /demo/helloworld-gitb、创建文件#echo “helloworld” > helloworld.txtc、将文件加入索引并提交#git add helloworld.txt#git commit -m ‘helloworld-master’(-m命令行参数helloworld-master是本次提交的备注,必须有)d、查看日志#git log,添加文本#echo “世界你好” > helloworld.txt,#cat helloworld.txt,恢复最近一次提交状态#git checkout helloworld.txt;创建本地分支a、查看分支#git branchb、创建新分支#git branch new-branchc、删除刚建立的分支(慎用)#git branch -D new-branch;切换本地分支:#git checkout new-branch,修改内容#echo ‘世界你好’  > helloworld.txt#git add helloworld.txt#git commit -m helloworld-new-branch;在GitHub上创建开源项目,注册免费用户(https://github.com/signup/free);上传源代码,生成密钥和公钥文件#ssh-keygen -t rsa -C ”注册账号的E-mail”并保存,在账户界面选择“SSh Public Keys”——》“Add another public key”——》复制内容到Key——》单击“Add key”,检测设置是否正确#ssh -T git@github.com;下载源代码#git clone git@git@github.com:androidguy/helloworld.git

    4、小结:Git是学习Android移植和Linux内核驱动开发必不可少的工具,而学习的方法是自己实践去操作,多动手。

  • 相关阅读:
    第五周学习进度
    第四周学习进度
    四则运算三
    第三周学习进度
    软件工程个人作业—四则运算2
    软件工程个人作业01
    软件工程概论—用户登录界面
    构建之法读书笔记06
    构建之法读书笔记05
    构建之法读书笔记04
  • 原文地址:https://www.cnblogs.com/wyan123/p/5439105.html
Copyright © 2011-2022 走看看