代码协同管理工具
SVN GIT
什么是git
- git是一个开源的分布式版本控制系统,用于高效敏捷的管理大小项目代码。
git特点
- git 可以管理各种文件,特别是代码项目,多使用在*nix系统中
- 是分布式管理,不同于集中管理,这是git和svn的核心区
- 更好的分支
- 拥有全球唯一的版本号
- 代码安全性更加有保证
- 开源方便,数据传输速度更快,可以无网络操作
集中式和分布式
- 集中式:代码集中管理,需要上传到中央处理器,每次更新都从中央服务器下载
- 分布式:每个节点都保存完整的代码,没有中央处理器,节点之间相互推送下载完成戴拿共享,(git)
git的安装
- linux下
sudo apt-get install git - windows:
msysgit.github.io
git的配置
- git配置工具:git config
配置级别
- 系统中所有用户都使用
/etc/gitconfig 文件
配置姓名
git config --system user.name [your name]
git config --system user.email [yourmail]arena@tedu:~/git$ git config --system user.name kang tarena@tedu:~/git$ sudo git config --system user.email [email protected] tarena@tedu:~/git$ ls tarena@tedu:~/git$ cd /etc tarena@tedu:/etc$ ls tarena@tedu:/etc$ cat gitconfig [user] name = kang email = [email protected]
- 作用于当前用户
~/.gitconfig 文件
git config --global user.name [yourname]
e.g.
sudo git config --global user.name Levitarena@tedu:~$ cat .gitconfig [user] name = Levi
- 作用于当前项目仓库
.git/config
配置编译器
git config core.editor [youreditor]
e.g.
git config core.editor vimarena@tedu:~/git$ git init 初始化空的 Git 仓库于 /home/tarena/git/.git/ tarena@tedu:~/git$ ls tarena@tedu:~/git$ ll 总用量 12 drwxrwxr-x 3 tarena tarena 4096 8月 30 19:57 ./ drwxr-xr-x 38 tarena tarena 4096 8月 30 19:47 ../ drwxrwxr-x 7 tarena tarena 4096 8月 30 19:57 .git/ tarena@tedu:~/git$ cd .git/ tarena@tedu:~/git/.git$ ls branches config description HEAD hooks info objects refs tarena@tedu:~/git/.git$ cat config [core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true tarena@tedu:~/git/.git$ cd tarena@tedu:~$ cd git tarena@tedu:~/git$ git config core.editor vim tarena@tedu:~/git$ cat .git/config [core] repositoryformatversion =