git 学习笔记(一)
来源:互联网 发布:淘宝虚假交易清洗过3次 编辑:程序博客网 时间:2024/05/29 07:32
Git 简述及安装简介
git是代码同步工具,至于它的优缺点就不说了!由于它是在Linux下产生的,如果在windows下进行学习,要安装Cygwin,注意在选择select package 时,要搜索到git然后安装;如果是在Linux下,直接在命令行安装即可,如命令:
sudo apt-get install git
Git学习笔记(一)
1.在使用git之前,首先要进行全局设置。必要设置的是name和Email
git config --global user.name "gobeike"git config --global user.Email "gobeike@sina.com"
删除全局配置文件user.name 和user.email 的做法:
git config --unset --global user.namegit config --unset --global user.email
2.创建工作目录及版本库
a>方法一
mkdir demo //创建目录democd demogit init //在demo 目录下创建版本库
b>方法二(在git 1.6+版本支持)
git init demo
3.把文件添加到版本库
git add welcome.txt //向版本库添加文件welcome.txt
a>git 提交文件后,用vi添加说明
git commit
b>git提交并添加提交说明
git commit -m "提交说明"
搜索版本库中的文件内容:
git grep "hello world" // 搜索版本库中文件内容为”hello world"
4备份工作区间demo的仓库
git clone demo demo-step-1
5.查看git的日志
git log --stat
按q键退出日志查看,
6.查看文件的状态
git status -s // 能看到文件的修改状态及添加和删除状态
7修改文件后提交
查看修改文件的差异
git diff HEAD
修改上面的文件welcome.txt,因为该文件已经添加到git版本库中了
echo "修改数据,看看git的修改提交方式" >> welcome.txt // 追加到文件welcome.txt 末端git add welcome.txt //git将修改的文件welcome.txt添加到提交任务中去
0 0
- GIT学习笔记(一)
- Git 学习笔记(一)
- git 学习笔记(一)
- Git学习笔记(一)
- Git学习笔记(一)
- Git学习笔记(一)
- Git学习笔记(一)
- 学习git笔记(一)
- git学习笔记(一)
- Git 学习笔记(一)
- Git学习笔记(一)
- Git学习笔记(一)
- Git学习笔记(一)
- git 学习笔记(一)
- git学习笔记(一)
- Git学习笔记(一)
- git 学习笔记(一)
- Git学习笔记(一)
- 黑马程序员————OC基础学习重要小知识点总结
- 2015年天勤考研机试模拟赛 B 删除结点
- 144.Binary Tree Preorder Traversal
- linux基础知识4-定时任务crontab
- How AWS made
- git 学习笔记(一)
- 设计模式--之状态模式(附代码)
- Android中一种ThreadPool的实现
- 基于matlab mex的平面点集按重心逆时针排序算法
- 【Tools.Redis】指令 - directives
- 使用Hibernate出现过的异常总结
- Android基础笔记(十七)- 多媒体编程
- MyEclipse中更换JDK及工程警告问题
- xml中的xmlns,xmlns:xsi,xsi:schemaLocation