When running the git log command, we can pass in options as arguments toformat the data shown for each commit. In this lesson, we show how to use the oneline, decorate, graph, stat, and p options with git log. Show it oneline: git log --oneline git l…
In the last lesson, we learned how to format the git log output; in this lesson we will learn how to filter down to a specific set of commits. By default, git log shows every commit in a repo. We will walk through using a bunch of options to filter o…
刚刚提交了三个commit, git reflog显示如下: 最后一个commit在文件末尾加了一行:v3,以此类推: 下面,使用git reset --hard commitID来进行commit回退:(应该回滚的时工作区的commit版本吧) 1)回到最后一个commit之前,即回到v2后的版本: git reset --hard fe0b7d6 ( 亦可以使用快捷的方式: git reset --hard HEAD ^   ,^ 表示回到上一个版本,如果需要回退到上上个版本的话,将HEAD…
Git 学习(三)本地仓库操作——git add & commit Git 和其他版本控制系统如SVN的一个不同之处就是有暂存区的概念.这在上文已有提及,本文具体说明什么是工作区及暂存区,以及如何使用本地git库的操作命令:重点 git add 及 git commit . 回顾上一章节版本库创建: 先将 D:盘下的 learngit 整个文件夹删除,然后创建空的 Git 版本库. 工作区 和  版本库 工作区(Working Directory)即操作系统中看到的文件夹,如  d:/learn…
下面是我整理的常用 Git 命令清单.几个专用名词的译名如下. Workspace:工作区 Index / Stage:暂存区 Repository:仓库区(或本地仓库) Remote:远程仓库 一.新建代码库 # 在当前目录新建一个Git代码库 $ git init # 新建一个目录,将其初始化为Git代码库 $ git init [project-name] # 下载一个项目和它的整个代码历史 $ git clone [url] 二.配置 Git的设置文件为.gitconfig,它可以在用户…
一.Git分布式版本控制简介 ​ Git 是一个很强大的分布式版本控制系统.它不但适用于管理大型开源软件的源代码,管理私人的文档和源代码也有很多优势.本来想着只把最有用.最常用的 Git 命令记下来,但是总觉得这个也挺有用.那个也用得着,结果越记越多.所以这里总结一下供大家查阅! 二.Git原理图 原理图名词解释: 笔者来源于公众号:软测之家  更多精彩技术分享,资料下载欢迎搜索关注! Workspace 工作区 Index / Stage 暂存区 Repository 本地仓库 Remote…
下面是我整理的常用 Git 命令清单.几个专用名词的译名如下. Workspace:工作区 Index / Stage:暂存区 Repository:仓库区(或本地仓库) Remote:远程仓库 一.新建代码库 # 在当前目录新建一个Git代码库 $ git init # 新建一个目录,将其初始化为Git代码库 $ git init [project-name] # 下载一个项目和它的整个代码历史 $ git clone [url] 二.配置 Git的设置文件为.gitconfig,它可以在用户…
Git官方提供的快速入门教程:https://try.github.io/levels/1/challenges/1 特点:Git极其强大的分支管理:分布式版本 集中式版本控制系统,版本库是集中存放在中央服务器的,而干活的时候,用的都是自己的电脑,所以要先从中央服务器取得最新的版本,然后开始干活,干完活了,再把自己的活推送给中央服务器.中央服务器就好比是一个图书馆,你要改一本书,必须先从图书馆借出来,然后回到家自己改,改完了,再放回图书馆.集中式版本控制系统最大的毛病就是必须联网才能工作. 使用…
基于 GitFlow 工作流,可能某个提交(commit)导致了 bug,或者有多个提交需要返工,此时你就会用到删除提交. 接下来的内容都基于下面这张 git log 提交记录图来写.   git log 删除最后的提交 当需要删除最新的提交.或最最近的几个提交.比如删除 1 或者 1~3 的提交,使用 git reset命令. 我们需要关注一下 git reset的 --hard 和 --soft 参数. 举个例子删除最近两个提交看看: git reset --soft commit~3 ,然…
Let's split our changes into separate commits. We'll be able to check over our changes before staging them all from the terminal. Then, we'll see the positive effect it has on our commit history. git add --patch 1. Then in the cmd, we can type 's' st…