第三章,Git使用入门

1、首先,了解Git 是什么?

  我们从Linux系统来看,Linux出名得益于它的开源,因此其内核版本众多,为了便于对这些源代码进行管理,Git便成为了管理源代码工具中的佼佼者。

2、如何安装Git

  对于不同版本的LInux安装也有所变化。

  对于Ubuntu版本的安装命令如下:

  # apt-get install git-core

  # apt-get install git-doc git-svn git-email git-gui gitk

  对于Rhel Fedora cenos :

  # yum install git

  # yum insatll git-doc git-svn git-email git-gui gitk

3、查看Git帮助文档:

  # man git-checkout    //man来查看帮助,后者是命令

4、以文本形式查看指定文档:

  # git help git-checkout

5、以HTML形式查看:

  # git help -w git-checkout 

6、创建本地版本库:
源代码工作目录是:helloworld-git
# mkdir -p /demo/helloworld-gt
# cd /demo/helloworld-gt
# git init 
7、将文件提交到本地版本库:
# cd /demo/helloworld-git
# echo "helloworld">helloworld.txt
# git add helloworld.txt 
# git comit -m ‘helloworld-master'
这是将一个helloworld。txt文本内容为“helloworld”的文本提交到本地版本库的索引中,并将helloworld。txt提交到本地版本库中。
其中 “-m” 是Git中必须要写备注信息。
8、创建本地分支:
# git branch //查看分支
# git branch new-branch //创建分支
# git branch -D new-branch //删除刚刚建立的分支
9、 # git checkout new-branch //将当前分支切换到new-branch
# git checkout master //切换到master分支

 主要大致要点就是以上几点,最重要的还是自己实践,不实践光看 还是不能熟悉这些命令的。

 

 

原文地址:http://www.cnblogs.com/lirui666666/articles/5432837.html 

转载于:https://www.cnblogs.com/lirui666666/p/5438763.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值