Git 命令及使用经验

手册中的基本命令:

CONFIGURE TOOLING

Configure user information for all local repositories

$ git config --global user.name "[name]"

Sets the name you want attached to your commit transactions

$ git config --global user.email "[email address]"

Sets the email you want attached to your commit transactions

$ git config --global color.ui auto

Enables helpful colorization of command line output

CREATE REPOSITORIES

Start a new repository or obtain one from an existing URL

$ git init [project-name]

Creates a new local repository with the specified name

$ git clone [url]

Downloads a project and its entire version history

MAKE CHANGES

Review edits and craft a commit transaction

$ git status

Lists all new or modified files to be committed

$ git add [file]

Snapshots the file in preparation for versioning

$ git reset [file]

Unstages the file, but preserve its contents

$ git diff

Shows file differences not yet staged

$ git diff --staged

Shows file differences between staging and the last file version

$ git commit -m "[descriptive message]"

Records file snapshots permanently in version history

REVIEW HISTORY

Browse and inspect the evolution of project files

$ git log

Lists version history for the current branch

$ git log --follow [file]

Lists version history for a file, including renames

$ git diff [first-branch]...[second-branch]

Shows content differences between two branches

$ git show [commit]

Outputs metadata and content changes of the specified commit

经验:

ERROR1: git statusgit diff出下面乱码

解决方法来源:http://www.cnblogs.com/vipzrx/p/3488717.html

解决方法: 键入命令 git config --global core.quotepath false

解决结果:问题解决

解决记录:如下图

[Git命令参考手册]  github-git-cheat-sheet.pdf

原文地址:https://www.cnblogs.com/dashawntang/p/9574611.html

时间: 2024-08-29 00:42:23

Git 命令及使用经验的相关文章

windows下git命令的使用

一.写在前面 关于git,出于自己的爱好,前段时间玩了一下,也自己上网查了一下资料,现简单记录一下,以备查看. 当然,本文并不是介绍配置git服务器的文章,而是以github服务器作为git的远程仓库服务器. 二.安装 windows下使用git,需要安装msysGit,下载地址是https://code.google.com/p/msysgit/downloads/list; 安装完成后,在安装目录下,有个msys.bat文件,这个就是msysGit提供的命令行客户端: 当然就像svn一样,也

常用 Git 命令清单

我每天使用 Git ,但是很多命令记不住. 一般来说,日常使用只要记住下图6个命令,就可以了.但是熟练使用,恐怕要记住60-100个命令. 下面是我整理的常用 Git 命令清单.几个专用名词的译名如下. Workspace:工作区 Index / Stage:暂存区 Repository:仓库区(或本地仓库) Remote:远程仓库 一.新建代码库 # 在当前目录新建一个Git代码库 $ git init # 新建一个目录,将其初始化为Git代码库 $ git init [project-nam

Git命令执行漏洞

Git命令造成的反弹shell 漏洞描述: Git LFS可以.lfsconfig使用LFS由存储库中的文件配置(部分),并且可以将Git LFS指向ssh://. [lfs] url = ssh://-oProxyCommand= some-command 当使用这样的.lfsconfig文件克隆存储库时,使用LFS插件的Git将尝试调用ssh以从主机获取LFS对象 -oProxyCommand=some-command.然而,SSH会将该主机名解释为一个-o选项,并随后尝试调用some-co

git命令行使用

1. git命令行配置 1)安装完git客户端之后,在任意目录右键鼠标,选择Git GUI Here 2)在打开的窗口中依次选择Help->> Show SSH Key 2)如果弹出的窗口中中间部分没有key,可以点击 Generate Key 按钮,生成key,然后将生成的key拷贝一下,添加到gitlab中即可. 2. 命令使用 1)下载代码 在存放代码的目录中,右键鼠标,选择 Git Bash Here,然后会打开终端窗口 输入: git init   创建git配置目录 输入下面命令,

常用 Git 命令清单 转

我每天使用 Git ,但是很多命令记不住. 一般来说,日常使用只要记住下图6个命令,就可以了.但是熟练使用,恐怕要记住60-100个命令. 下面是我整理的常用 Git 命令清单.几个专用名词的译名如下. Workspace:工作区 Index / Stage:暂存区 Repository:仓库区(或本地仓库) Remote:远程仓库 一.新建代码库 # 在当前目录新建一个Git代码库 $ git init # 新建一个目录,将其初始化为Git代码库 $ git init [project-nam

常用 Git 命令清单【转】

转自:http://www.ruanyifeng.com/blog/2015/12/git-cheat-sheet.html 作者: 阮一峰 日期: 2015年12月 9日 我每天使用 Git ,但是很多命令记不住. 一般来说,日常使用只要记住下图6个命令,就可以了.但是熟练使用,恐怕要记住60-100个命令. 下面是我整理的常用 Git 命令清单.几个专用名词的译名如下. Workspace:工作区 Index / Stage:暂存区 Repository:仓库区(或本地仓库) Remote:

git命令评测

近日得知git命令在库进行操作,查找git尽管小命令(当然,也不能太小),但他们是一个非常强大的组合,更重要的是,它是非常的效果不同状态的命令是不一样的打.该博文总结git命令.. Git命令 命令小结 命令 功能 git init 把当前目录初始化为默认的git库 git add 文件名称 向git库中加入一个文件 git rm 文件名称 从git库中删除一个文件 git status 查看当前库中进行的任务 git diff 文件名称 add前查看工作区和暂存区的区别 git commit

我总结的git命令指南。

git命令行指南 1.windows上安装git的网址:http://msysgit.github.com/. 没有安装过git的 这个网址里下mymsgit. 因为发现有些同学对git还不是那么熟悉,所以我分享一下一下我自己整理出来的常用的git的命令行指令. 对了.对于任何一个文件,在 Git 内都只有三种状态:已提交(committed),已修改(modified)和已暂存(staged).已提交表示该文件已经被安全地保存在本地数据库中了:已修改表示修改了某个文件,但还没有提交保存:已暂存

常用Git命令汇总

常用Git命令汇总 跟着R哥来到了新公司(一个从硬件向互联网转型中的公司),新公司以前的代码基本是使用SVN做版本控制,甚至有些代码没有做版本控制,所以R哥叫HG做了一次Git分享,准备把公司所有的代码用Git作版本控制.平时自己虽然天天使用Git,但是总感觉知识有些零散,于是汇总了一些常用的Git命令. 常用配置 --system #系统级别 --global #用户全局 --local #单独一个项目 git config --global user.name "xxxx" #用户