Git 安装及使用小结
Git 安装及使用小结
a:focus {
outline: thin dotted #333;
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px;
}
a:hover {
outline: 0;
}
a:active {
outline: 0;
}
a:hover {
color: #005580 !important;
text-decoration: underline !important;
}
blockquote small:before {
content: '\2014 \00A0';
}
q:before {
content: "";
}
q:after {
content: "";
}
blockquote:before {
content: "";
}
blockquote:after {
content: "";
}
.hljs-folder:before {
top: 0;
content: '';
width: 14px;
height: 12px;
margin-top: 0px;
margin-right: 3px;
position: relative;
display: inline-block;
background-size: 14px;
background-repeat: no-repeat;
}
.hljs-file:before {
top: 0;
content: '';
width: 14px;
height: 12px;
margin-top: 0px;
margin-right: 3px;
position: relative;
display: inline-block;
background-size: 14px;
background-repeat: no-repeat;
}
.hljs-hiddenfile:before {
top: 0;
content: '';
width: 14px;
height: 12px;
margin-top: 0px;
margin-right: 3px;
position: relative;
display: inline-block;
background-size: 14px;
background-repeat: no-repeat;
}
.hljs-file:before {
height: 14px;
margin-left: 1px;
}
.hljs-hiddenfile:before {
height: 14px;
margin-left: 1px;
}
.hljs-file.photo:before {
font: normal normal normal 14px / 1 FontAwesome;
content: "\f1c5";
}
.hljs-file.plain:before {
font: normal normal normal 14px / 1 FontAwesome;
content: "\f016";
}
.hljs-file.source:before {
font: normal normal normal 14px / 1 FontAwesome;
content: "\f1c9";
}
.hljs-file.archive:before {
font: normal normal normal 14px / 1 FontAwesome;
content: "\f1c6";
}
.hljs-file.audio:before {
font: normal normal normal 14px / 1 FontAwesome;
content: "\f1c7";
}
.hljs-file.video:before {
font: normal normal normal 14px / 1 FontAwesome;
content: "\f1c8";
}
.hljs-file.pdf:before {
font: normal normal normal 14px / 1 FontAwesome;
content: "\f1c1";
}
.hljs-file.xls:before {
font: normal normal normal 14px / 1 FontAwesome;
content: "\f1c3";
}
.hljs-file.doc:before {
font: normal normal normal 14px / 1 FontAwesome;
content: "\f1c2";
}
.hljs-file.ppt:before {
font: normal normal normal 14px / 1 FontAwesome;
content: "\f1c4";
}
.hljs-folder:before {
font: normal normal normal 14px / 1 FontAwesome;
content: "\f114";
}
.hljs-hiddenfile:before {
font: normal normal normal 14px / 1 FontAwesome;
content: "\f016";
}
.li_linenum:before {
content: counter(lines , decimal);
position: absolute;
left: 0px;
text-align: center;
width: 2.5em;
opacity: 0.5;
vertical-align: top;
}
a:focus {
outline: thin dotted #333;
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px;
}
a:hover {
outline: 0;
}
a:active {
outline: 0;
}
a:hover {
color: #005580 !important;
text-decoration: underline !important;
}
blockquote small:before {
content: '\2014 \00A0';
}
q:before {
content: "";
}
q:after {
content: "";
}
blockquote:before {
content: "";
}
blockquote:after {
content: "";
}
.hljs-folder:before {
top: 0;
content: '';
width: 14px;
height: 12px;
margin-top: 0px;
margin-right: 3px;
position: relative;
display: inline-block;
background-size: 14px;
background-repeat: no-repeat;
}
.hljs-file:before {
top: 0;
content: '';
width: 14px;
height: 12px;
margin-top: 0px;
margin-right: 3px;
position: relative;
display: inline-block;
background-size: 14px;
background-repeat: no-repeat;
}
.hljs-hiddenfile:before {
top: 0;
content: '';
width: 14px;
height: 12px;
margin-top: 0px;
margin-right: 3px;
position: relative;
display: inline-block;
background-size: 14px;
background-repeat: no-repeat;
}
.hljs-file:before {
height: 14px;
margin-left: 1px;
}
.hljs-hiddenfile:before {
height: 14px;
margin-left: 1px;
}
.hljs-file.photo:before {
font: normal normal normal 14px / 1 FontAwesome;
content: "\f1c5";
}
.hljs-file.plain:before {
font: normal normal normal 14px / 1 FontAwesome;
content: "\f016";
}
.hljs-file.source:before {
font: normal normal normal 14px / 1 FontAwesome;
content: "\f1c9";
}
.hljs-file.archive:before {
font: normal normal normal 14px / 1 FontAwesome;
content: "\f1c6";
}
.hljs-file.audio:before {
font: normal normal normal 14px / 1 FontAwesome;
content: "\f1c7";
}
.hljs-file.video:before {
font: normal normal normal 14px / 1 FontAwesome;
content: "\f1c8";
}
.hljs-file.pdf:before {
font: normal normal normal 14px / 1 FontAwesome;
content: "\f1c1";
}
.hljs-file.xls:before {
font: normal normal normal 14px / 1 FontAwesome;
content: "\f1c3";
}
.hljs-file.doc:before {
font: normal normal normal 14px / 1 FontAwesome;
content: "\f1c2";
}
.hljs-file.ppt:before {
font: normal normal normal 14px / 1 FontAwesome;
content: "\f1c4";
}
.hljs-folder:before {
font: normal normal normal 14px / 1 FontAwesome;
content: "\f114";
}
.hljs-hiddenfile:before {
font: normal normal normal 14px / 1 FontAwesome;
content: "\f016";
}
.li_linenum:before {
content: counter(lines , decimal);
position: absolute;
left: 0px;
text-align: center;
width: 2.5em;
opacity: 0.5;
vertical-align: top;
}
Git 安装及使用小结
git
Git安装与配置
Linux下安装与配置
通过命令行 sudo apt-get install git 进行安装
配置 git config --global user.name "xxx", git config --global user.email "xxx@xxx.com" (global 选项可选)
使用 git push到github时,需要在github上添加本机的SSH key
生成SSH Key: ssh-keygen -t rsa -C "xxx@xxx.com" (按三个回车即可,一般不使用密码)
生成的key在 ~/.ssh 目录下,该目录下包含两个文件: id_ras(私钥), id_rsa.pub(公钥)
添加私钥:ssh-add id_rsa
在github上添加ssh key. 在 setting->SSH and GPG Keys下添加 id_ras.pub 中内容
windows下安装与配置
直接下载安装 git
配置与linux 下类似
通过命令行 sudo apt-get install git 进行安装
配置 git config --global user.name "xxx", git config --global user.email "xxx@xxx.com" (global 选项可选)
使用 git push到github时,需要在github上添加本机的SSH key
生成SSH Key:
ssh-keygen -t rsa -C "xxx@xxx.com"(按三个回车即可,一般不使用密码)生成的key在
~/.ssh目录下,该目录下包含两个文件:id_ras(私钥),id_rsa.pub(公钥)添加私钥:
ssh-add id_rsa在github上添加ssh key. 在 setting->SSH and GPG Keys下添加
id_ras.pub中内容
直接下载安装 git
配置与linux 下类似
说明: git config命令的--global参数,用了这个参数,表示你这台机器上所有的Git仓库都会使用这个配置,当然也可以对某个仓库指定不同的用户名和Email地址.
常见操作命令
创建版本库
git init : 创建版本库
git add . : 添加文件到版本库,“.”表示目录下所有文件,也可通过文件名或目录指定
git rm xxx: 从版本库中删除一个文件
git commit -m "xxx": 提交文件,-m选项表示的示提交说明
查看文件改动
git status: 查看工作区文件变动情况,显示那些文件被修改过
git diff xxx: 查看文件xxx的修改内容
gitk: 图形化界面各版本修改情况
版本回退
git log: 查看提交历史,由近到远排列,git log --pretty=oneline 简化输出信息
git reset --hard xxx: xxx 为 commit id,回退到指定commit id 的版本
git reflog: 查看历史命令,以便确定回到未来哪个版本
撤销单个文件的修改
若文件没有执行 add 操作
git checkout -- xxx : 直接丢弃工作区文件xxx的修改
若文件执行过add 操作, 需执行两步
git reset HEAD xxx --> git checkout -- xxx
关联远程仓库与本地仓库
首先需要在github中手动新建分支
一种方式是将分支 clone 到本地,进行修改,然后提交。
git clone git@github.com:username/RepositoryName.git
另一种方式是,讲本地已有仓库与之关联。
git remote add origin git@github.com:username/RepositoryName.git
提交本地库内容到远程库
git push -u origin master: 将当前master分支推送当远程分支origin, -u参数,表示将本地master分支与远程的origin分支关联起来,在以后的推送或者拉取时,可以简化命令git push origin master
附件列表
Git 安装及使用小结的更多相关文章
- Git安装
前面说了很多废话,说得再好,还不如实践一次.要想使用Git,首先得安装.这次实验主要是实践怎样安装Git. 安装与检查是否安装成功 1. 在Linux(Ubuntu)上安装 上篇的Git简介已经介绍过 ...
- g4e基础篇#3 Git安装与配置
g4e 是 Git for Enterprise Developer的简写,这个系列文章会统一使用g4e作为标识,便于大家查看和搜索. 章节目录 前言 1. 基础篇: 为什么要使用版本控制系统 Git ...
- git安装和使用配置
1.简介 Git是一个开源的分布式版本控制系统,能用于快速高效地处理任何或小或大的项目,它是Linus Torvalds为了帮助管理Linux内核开发而开发的一个源码开放的版本控制软件. 2.Linu ...
- CentOS 7 Git安装
Git安装 yum -y install git 安装后,在srv目录下建立Git的目录. 初始化一个git空仓库 git init --bare project.git 增加用于访问git仓库的用户 ...
- Git安装与配置
一.简介 Git是一款免费.开源的分布式版本控制系统,用于敏捷高效地处理任何或小或大的项目版本管理. Git 是 Linus Torvalds 为了帮助管理 Linux 内核开发而开发的一个开放源码的 ...
- 版本管理之Git(二):Win7上Git安装及简单配置过程
一.安装包 msysgit(Windows版本的Git) 下载地址:http://code.google.com/p/msysgit/downloads/list?q=full+installer+o ...
- git安装及命令使用和github网站
最近参与别人的github项目时,学习了git的使用,首先需要在https://github.com/网站上注册账号和邮箱,然后fork一个开源项目,然后下载目前Windows下最新版本的git,下载 ...
- Git 安装
安装参考资料: http://lzw.me/a/msysgit-tortoisegit-win-git.html http://blog.csdn.net/qwiwuqo/article/detail ...
- 转 git安装配置
Win7上Git安装及配置过程 一.安装说明 1.Git在windows平台上安装说明. Git 是 Linux Torvalds 为了帮助管理 Linux 内核开发而开发的一个开放源码的版本控制软件 ...
随机推荐
- 【RF库XML测试】Get Element Text
Name:Get Element TextSource:XML <test library>Arguments:[ source | xpath=. | normalize_whitesp ...
- sqlite3常用指令
一.建立数据库 sqlite3.exe test.db 二.双击sqlite-3_6_16目录下的程序sqlite3.exe,即可运行 三.退出 .exit 或者 .quit 四.SQLite支持如下 ...
- linux 开机自启转载
设置开机启动示例: # touch /etc/init.d/rc.local 设置为可执行: # chmod +x /etc/init.d/rc.local 用 update-rc.d 设置启动级别: ...
- 从经典问题来看 Copy 方法
经典面试题:为什么 NSString 类型成员变量的修饰属性用 copy 而不是 strong (或 retain ) ? 在初学 iOS 的时候,可能会被灌输这么一个常识,切记 NSString 的 ...
- Delphi Code Editor 之 基本操作
Delphi Code Editor 之 基本操作 毫无疑问,Delphi是高度可视化的.这是使用Delphi进行编程的最大好处之一.当然,任何一个有用的程序中都有大量手工编写的代码.当读者开始编写应 ...
- 【JavaScript】如何判断一个对象是未定义的?(已解决)
JavaScript中,如果使用了一个未定义的变量,会有这样的错误提示:XXX未定义. 代码中,怎样才能判定一个对象是否定义了呢? 使用 typeof 示例: if("undefined& ...
- 查看运行中的Java其配置的堆大小
一.背景 有题目中的需求,也不是空穴来风:前一阵给公司搭建了一个持续集成服务器,Jenkins.最近发现,运行一段时间后,就变慢了. 随便一个操作,cpu就飙高了.然后就思考会不会是内存不够用,频繁G ...
- HDU 2102 A计划(BFS/DFS走迷宫)
A计划 Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submis ...
- android开发,权限获取
转:http://blog.csdn.net/yawinstake/article/details/6748897 访问登记属性 android.permission.ACCESS_CHECKIN_P ...
- TypeScript中处理大数字(会丢失后面部分数字)
为啥要弄这玩意? 最近做数值游戏,需要用到很大的数字,在前端大数字会自动变成e的科学计数法. 有啥问题? 问题: 1. 在传递给服务端时,服务端因为不能处理大数字(怎么就处理不了?!),就想要我传字符 ...