版本控制管理工具--git的学习记录
2015-07-13 16:35
627 查看
起步:
1.git的三种状态,git status命令:modified,staged,commited
2.git安装:1.使用安装包 2.从源码安装(优)
3.配置存放目录: /etc/gitconfig git config命令使用--system选项
~/.gitconfig 用户目录 --global选项
.git/config 当前项目工作目录
4.配置文件编辑器: git config --global core.editor vim
5.配置差异分析 git config --global merge.tool vimdiff
6.查看配置:git config --list
git config user.name
7.帮助:方式一: git help config
方式二:git <verb> --help
方式三:man git-<verb>
基础:
8.取得项目git仓库 1.从已有项目 在项目目录下git init
2.clone git clone git://........... mygrit (mygrit为自定义目录名默认为grit)
9.git add 文件名 纳入版本控制,进入暂存状态
git status 可以查看暂存状态 和未纳入版本控制,修改但未提交的文件
git commit 提交,必须要经过git add的文件才会被提交
10.配置gitignore文件 cat .gitignore 是不是就先用vim创建一个.gitignore文件呢?
11.查看具体修改了哪些地方 git diff 已修改但未暂存和快照的差异
git diff --cached 已暂存和快照间差异
12.提交时加参数:git commit -v (将修改差异的每一行显示到注释)
git commit -m "注释说明"
13.跳过暂存提交:git commit -a 对所有已跟踪的文件暂存并提交
14.删除文件:git rm filename (删除本地并从暂存中删除)提交后不会纳入版本控制了,也可以先手动删除本地文件
git rm -f finlename (已经暂存时加-f)
git rm --cached filename (从暂存中删除)但本地保留
15.移动文件: git mv oldname newname
相当于:mv oldname newnamne
git rm oldname
igt add newname
16.提交历史:git log
gil log -p -2 (还有--stat --pretty常用)
17.查看当前配置有哪些远程仓库, git remote 命令
18.提交到远程仓库:git push origin master origin仓库名,master是分支名
19.标签查看:git tag
分支:
19. git branch branchname
20.git checkout branchname
在服务器部署 Git:
21. 克隆纯仓:$ git clone --bare my_project my_project.git
22. 将纯目录转移到服务器(假设一个域名为 git.example.com 的服务器已经架设好,并可以通过 SSH 访问,而你想把所有的 Git仓库储存在 /opt/git 目录下):
$ scp -r my_project.git user@git.example.com:/opt/git
---实战-在服务器部署 Git(服务器为Ubuntu系统)---
ssh登录服务器后:
1.安装:apt-get install git-core
2.创建/home/projects/git 用于存放git仓库
客户端本地:
1. 在本地做一个仓库(也可以找一个已有仓库):
cd /home
mkdir gexiuserver
cd gexiuserver
git init
2.克隆纯仓(gexiuserver是第一步中创建的仓库或是已前的仓库):
cd /home
git clone --bare gexiuserver gexiuserver.git
就可以在/home目录下找到一个gexiuserver.git文件目录了
3.将纯目录转移到服务器:
scp -r gexiuserver.git user@example.com:/home/projects/git
4.使用:
git clone ssh://user@example.com//home/projects/git/gexiuserver.git
cd gexiuserver
get push origin master (第一次push要加仓库与分支名origin master以后就不需要了)
1.git的三种状态,git status命令:modified,staged,commited
2.git安装:1.使用安装包 2.从源码安装(优)
3.配置存放目录: /etc/gitconfig git config命令使用--system选项
~/.gitconfig 用户目录 --global选项
.git/config 当前项目工作目录
4.配置文件编辑器: git config --global core.editor vim
5.配置差异分析 git config --global merge.tool vimdiff
6.查看配置:git config --list
git config user.name
7.帮助:方式一: git help config
方式二:git <verb> --help
方式三:man git-<verb>
基础:
8.取得项目git仓库 1.从已有项目 在项目目录下git init
2.clone git clone git://........... mygrit (mygrit为自定义目录名默认为grit)
9.git add 文件名 纳入版本控制,进入暂存状态
git status 可以查看暂存状态 和未纳入版本控制,修改但未提交的文件
git commit 提交,必须要经过git add的文件才会被提交
10.配置gitignore文件 cat .gitignore 是不是就先用vim创建一个.gitignore文件呢?
11.查看具体修改了哪些地方 git diff 已修改但未暂存和快照的差异
git diff --cached 已暂存和快照间差异
12.提交时加参数:git commit -v (将修改差异的每一行显示到注释)
git commit -m "注释说明"
13.跳过暂存提交:git commit -a 对所有已跟踪的文件暂存并提交
14.删除文件:git rm filename (删除本地并从暂存中删除)提交后不会纳入版本控制了,也可以先手动删除本地文件
git rm -f finlename (已经暂存时加-f)
git rm --cached filename (从暂存中删除)但本地保留
15.移动文件: git mv oldname newname
相当于:mv oldname newnamne
git rm oldname
igt add newname
16.提交历史:git log
gil log -p -2 (还有--stat --pretty常用)
17.查看当前配置有哪些远程仓库, git remote 命令
18.提交到远程仓库:git push origin master origin仓库名,master是分支名
19.标签查看:git tag
分支:
19. git branch branchname
20.git checkout branchname
在服务器部署 Git:
21. 克隆纯仓:$ git clone --bare my_project my_project.git
22. 将纯目录转移到服务器(假设一个域名为 git.example.com 的服务器已经架设好,并可以通过 SSH 访问,而你想把所有的 Git仓库储存在 /opt/git 目录下):
$ scp -r my_project.git user@git.example.com:/opt/git
---实战-在服务器部署 Git(服务器为Ubuntu系统)---
ssh登录服务器后:
1.安装:apt-get install git-core
2.创建/home/projects/git 用于存放git仓库
客户端本地:
1. 在本地做一个仓库(也可以找一个已有仓库):
cd /home
mkdir gexiuserver
cd gexiuserver
git init
2.克隆纯仓(gexiuserver是第一步中创建的仓库或是已前的仓库):
cd /home
git clone --bare gexiuserver gexiuserver.git
就可以在/home目录下找到一个gexiuserver.git文件目录了
3.将纯目录转移到服务器:
scp -r gexiuserver.git user@example.com:/home/projects/git
4.使用:
git clone ssh://user@example.com//home/projects/git/gexiuserver.git
cd gexiuserver
get push origin master (第一次push要加仓库与分支名origin master以后就不需要了)
相关文章推荐
- APP watch teardown
- asp.net treeview遍历递归获取当前节点所有子级(含子级的子级)
- 用PHP Session和Javascript实现文件上传进度条
- MTK kernel log Tool
- hadoop主机名和hbase连接名配置问题记录
- 颜色匹配
- Ubuntu14.04.02(32位)交叉编译vlc2.2.1
- 证书错误总结(1)
- 你必须了解的Session的本质
- ZH奶酪:Ubuntu启动/重启/停止apache服务
- 给iOS工程增加Daily Build
- 七步从Angular.JS菜鸟到专家(3):数据绑定和AJAX
- 欢迎使用CSDN-markdown编辑器
- 让程序员跳槽的非钱原因,分析很深刻
- java BigDecimal的用法简介
- HDU 5281 Senior's Gun 杀怪
- eclipse xml文件中按alt+/没有提示信息?
- 自定义彩色Toast
- 关于宏定义
- MongoDB高级查询详细