Git开发实战(一)之Git的安装配置与基本操作
2017-10-23 00:00
696 查看
摘要: Git开发实战系列第一篇学习笔记,本篇笔记主要包括了对Git的安装、配置以及Git的基本命令的操作!
一、Git的安装
1.Linux
apt-get insatll git ubuntu
yum install git centos/redhat
2.Mac OS
xcode应该自带了
3.Windows
也有客户端(实际上就是windows上的命令行)git官网 git-scm.com
4.提示
不要迷信图形化工具!
好用的Git是没有图形化工具的!命令行是王道!特别是新手,不要偷懒!
本《Git开发实战》系列博客是在Windows的git_shell中进行命令行操作的
二、Git的配置和基本操作
1.Git安装成功后,使用git命令,查看git的一些常见命令
2.可以通过git --version命令查看当前git的版本信息
3.配置文件,包括全局配置和局部配置
全局配置:
(1)使用cat ~/.gitconfig命令就可以进入到git的home目录下并显示出git的全局配置信息
(2)使用vim ~/.gitconfig命令可以编辑git的全局配置信息文件
局部配置:
(1)首先,我在桌面上使用mkdir命令创建一个目录test-git,然后用cd命令切换到这个目录下,然后使用ls -altrh查看这个目录下有什么文件,发现新创建的目录下,什么也没有!
(2)然后使用git init命令对test-git这个目录进行了git版本控制,然后会发现这个目录下会多出一个.git的目录
(3)接着使用vim .git/ 命令,我们可以看到.git下面有好几个目录,如图所示:
(4)我们用上下键移动到config这个文件上,然后进入这个文件,我们可以看到如下配置信息:
(5)我们可以直接在这个文件中修改配置信息,当然我们也可以通过命令git config user.name kevin进行修改
本文为原创文章,如果对你有一点点的帮助,别忘了点赞哦!比心!如需转载,请注明出处,谢谢!
一、Git的安装
1.Linux
apt-get insatll git ubuntu
yum install git centos/redhat
2.Mac OS
xcode应该自带了
3.Windows
也有客户端(实际上就是windows上的命令行)git官网 git-scm.com
4.提示
不要迷信图形化工具!
好用的Git是没有图形化工具的!命令行是王道!特别是新手,不要偷懒!
本《Git开发实战》系列博客是在Windows的git_shell中进行命令行操作的
二、Git的配置和基本操作
1.Git安装成功后,使用git命令,查看git的一些常见命令
aibin@XiaoAibin MINGW64 ~/Desktop $ git usage: git [--version] [--help] [-C <path>] [-c name=value] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path] [-p | --paginate | --no-pager] [--no-replace-objects] [--bare] [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>] <command> [<args>] These are common Git commands used in various situations: start a working area (see also: git help tutorial) clone Clone a repository into a new directory init Create an empty Git repository or reinitialize an existing one work on the current change (see also: git help everyday) add Add file contents to the index mv Move or rename a file, a directory, or a symlink reset Reset current HEAD to the specified state rm Remove files from the working tree and from the index examine the history and state (see also: git help revisions) bisect Use binary search to find the commit that introduced a bug grep Print lines matching a pattern log Show commit logs show Show various types of objects status Show the working tree status grow, mark and tweak your common history branch List, create, or delete branches checkout Switch branches or restore working tree files commit Record changes to the repository diff Show changes between commits, commit and working tree, etc merge Join two or more development histories together rebase Reapply commits on top of another base tip tag Create, list, delete or verify a tag object signed with GPG collaborate (see also: git help workflows) fetch Download objects and refs from another repository pull Fetch from and integrate with another repository or a local branch push Update remote refs along with associated objects 'git help -a' and 'git help -g' list available subcommands and some concept guides. See 'git help <command>' or 'git help <concept>' to read about a specific subcommand or concept.
2.可以通过git --version命令查看当前git的版本信息
aibin@XiaoAibin MINGW64 ~/Desktop $ git --version git version 2.10.0.windows.1
3.配置文件,包括全局配置和局部配置
全局配置:
(1)使用cat ~/.gitconfig命令就可以进入到git的home目录下并显示出git的全局配置信息
aibin@XiaoAibin MINGW64 ~/Desktop $ cat ~/.gitconfig
(2)使用vim ~/.gitconfig命令可以编辑git的全局配置信息文件
aibin@XiaoAibin MINGW64 ~/Desktop $ vim ~/.gitconfig
局部配置:
(1)首先,我在桌面上使用mkdir命令创建一个目录test-git,然后用cd命令切换到这个目录下,然后使用ls -altrh查看这个目录下有什么文件,发现新创建的目录下,什么也没有!
aibin@XiaoAibin MINGW64 ~/Desktop $ mkdir test_git aibin@XiaoAibin MINGW64 ~/Desktop $ cd test_git aibin@XiaoAibin MINGW64 ~/Desktop/test_git $ ls -altrh total 28K drwxr-xr-x 1 aibin 197609 0 10月 23 14:50 ../ drwxr-xr-x 1 aibin 197609 0 10月 23 14:50 ./
(2)然后使用git init命令对test-git这个目录进行了git版本控制,然后会发现这个目录下会多出一个.git的目录
aibin@XiaoAibin MINGW64 ~/Desktop/test_git $ git init . Initialized empty Git repository in C:/Users/aibin/Desktop/test_git/.git/ aibin@XiaoAibin MINGW64 ~/Desktop/test_git (master) $ ls -altrh total 32K drwxr-xr-x 1 aibin 197609 0 10月 23 14:50 ../ drwxr-xr-x 1 aibin 197609 0 10月 23 14:52 ./ drwxr-xr-x 1 aibin 197609 0 10月 23 14:52 .git/
(3)接着使用vim .git/ 命令,我们可以看到.git下面有好几个目录,如图所示:
(4)我们用上下键移动到config这个文件上,然后进入这个文件,我们可以看到如下配置信息:
[core] repositoryformatversion = 0 filemode = false bare = false logallrefupdates = true symlinks = false ignorecase = true [user] name = kevinShaw email = aibinxiao@126.com
(5)我们可以直接在这个文件中修改配置信息,当然我们也可以通过命令git config user.name kevin进行修改
aibin@XiaoAibin MINGW64 ~/Desktop/test_git (master) $ git config user.name kevinShaw
本文为原创文章,如果对你有一点点的帮助,别忘了点赞哦!比心!如需转载,请注明出处,谢谢!
相关文章推荐
- Android入门:开发Google Map的基本准备工作整理 包括AVD 驱动的安装配置
- 数据库开发基本操作-Microsoft SQL Server Management Studio Express下载和安装
- 4、ubuntu基本操作 - fcitx安装与配置(小企鹅输入法)
- django-10-数据库使用04 后台安装配置及增加用户对数据库基本读写操作
- Nosql之Mongodb 1 安装配置与基本操作
- Zabbix 安装,配置和基本操作文档
- MongoDB安装配置与基本操作
- 【Linux 操作系统】阿里云服务器 操作实战 部署C语言开发环境(vim配置,gcc) 部署J2EE网站(jdk,tomcat)
- redhat mysql 安装配置及基本操作
- Git配置安装使用教程操作github上传克隆数据
- git简介、安装、基本操作——Git折腾小记
- 【转】Vista下玩转php开发 IIS7下安装配置php实战指南
- [原]阿里云服务器 操作实战 部署C语言开发环境(vim配置,gcc) 部署J2EE网站(jdk,tomcat)
- reids&nbsp;安装配置&nbsp;基本操作
- 数据库开发基本操作-安装Sql Server 2005出现“性能监视器计数器要求”错误解决方法
- 第1章 Java基本概念及环境配置——FAQ1.12 如何安装Java基本开发环境JDK?
- 阿里云服务器 操作实战 部署C语言开发环境(vim配置,gcc) 部署J2EE网站(jdk,tomcat)
- (转载)SoftIce的安装、配置以及一些基本操作
- python开发 Mysqldb安装及基本操作
- Subversion基础:概念、安装、配置和基本操作