备注

一: Staging Modified Files

Let’s change a file that was already tracked. (tracked 表示该文件已经被git管理过,再次修改了文件的状态。对应状态是untracked或not staged

tracked n:轨道,足迹,踪迹,小道。verb:追踪;通过;循路而行;

二:git add (后该文件为已标记(tracked),状态为Modified )

git add is a multipurpose command — you use it to begin tracking new files, to stage files, and to do other things like marking merge-conflicted files as resolved. It may be helpful to think of it more as “add precisely this content to the next commit” rather than “add this file to the project”.

purpose1> 跟踪一个新文件

purpose2> 跟踪一个修改后的文件

purpose3> 把合并(特指冲突)后的文件标记为已解决(有点像功能2)

参考资料:https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository

三:Ignoring Files(忽略文件)

The rules for the patterns you can put in the .gitignore file are as follows:

  • Blank lines or lines starting with # are ignored.

  • Standard glob patterns work, and will be applied recursively throughout the entire working tree.

  • You can start patterns with a forward slash (/) to avoid recursivity.

  • You can end patterns with a forward slash (/) to specify a directory.

  • You can negate a pattern by starting it with an exclamation point (!).

Glob patterns are like simplified regular expressions that shells use.

*  An asterisk (*) matches zero or more characters;

* [abc] matches any character inside the brackets (in this case a, b, or c);

*  a question mark (?) matches a single character;

*  and brackets enclosing characters separated by a hyphen ([0-9]) matches any character between them (in this case 0 through 9).

*  You can also use two asterisks to match nested directories; a/**/z would match a/za/b/za/b/c/z, and so on.

四: cover

  • vt. 包括;采访,报导(讨论);涉及;行走(一段路程);掩护;翻唱
  • n. 封面,封皮;盖子;掩蔽物;幌子,借口
  • vi. 覆盖;代替;敷衍;给…投保;

eg : We’ll cover(讨论) git diff in more detail later, but you’ll probably use it most often to answer these two questions:

五:git diff

To see what you’ve changed but not yet staged, type git diff with no other arguments:

   git diff --stateg(--staged and --cached are synonyms):

if you want to see what you’ve staged that will go into your next commit, you can use git diff --staged. This command compares your staged changes to your last commit:

六:Viewing the Commit History(git log)

By default, with no arguments, git log lists the commits made in that repository in reverse chronological order; that is, the most recent commits show up first. As you can see, this command lists each commit with its SHA-1 checksum, the author’s name and email, the date written, and the commit message.

Common options to git log

Option Description

-p

Show the patch introduced with each commit.

--stat

Show statistics for files modified in each commit.

--shortstat

Display only the changed/insertions/deletions line from the --stat command.

--name-only

Show the list of files modified after the commit information.

--name-status

Show the list of files affected with added/modified/deleted information as well.

--abbrev-commit

Show only the first few characters of the SHA-1 checksum instead of all 40.

--relative-date

Display the date in a relative format (for example, “2 weeks ago”) instead of using the full date format.

--graph

Display an ASCII graph of the branch and merge history beside the log output.

--pretty

Show commits in an alternate format. Options include oneline, short, full, fuller, and format (where you specify your own format).

--oneline

Shorthand for --pretty=oneline --abbrev-commit used together.

七:Undoing Things

7.1  git commit --amend

This command takes your staging area and uses it for the commit. If you’ve made no changes since your last commit (for instance, you run this command immediately after your previous commit), then your snapshot will look exactly the same, and all you’ll change is your commit message.

7.2  Unstaging a Staged File

八:Adding Remote Repositories

To add a new remote Git repository as a shortname you can reference easily, run git remote add <shortname> <url>

九:Fetching and Pulling from Your Remotes(git fetch versus  git pull)

git fetch

It’s important to note that the git fetch command only downloads the data to your local repository — it doesn’t automatically merge it with any of your work or modify what you’re currently working on. You have to merge it manually into your work when you’re ready.

git pull

If your current branch is set up to track a remote branch , you can use the git pull command to automatically fetch and then merge that remote branch into your current branch. This may be an easier or more comfortable workflow for you; and by default, the git clone command automatically sets up your local master branch to track the remote master branch (or whatever the default branch is called) on the server you cloned from. Running git pull generally fetches data from the server you originally cloned from and automatically tries to merge it into the code you’re currently working on.

英语笔记3(git)的更多相关文章

  1. 英语笔记3(git)

    一: To create a new branch and switch to it at the same time, you can run the git checkout command wi ...

  2. Git 笔记三 Git的初步使用

    Git 笔记三 Git的初步使用 在上一篇中,学习了如何配置Git环境,这一篇,开始学习Git的初步使用.Git的初步使用还是很简单的.总体上知道git init, git clone, git ad ...

  3. Git 笔记二-Git安装与初始配置

    git 笔记二-Git安装与初始配置 Git的安装 由于我日常生活和工作基本上都是在Windows上,因此此处只说windows上的安装.Windows上的安装和其他程序一样,只需要到http://g ...

  4. Git 笔记一 Git简介

    git 笔记一 什么是版本控制 所谓版本控制就是记录对文件的修改记录,这样以后就能回退到需要的 版本.比如你对一段代码进行了几次修改,有几次修改不想要了,如果 使用了版本控制,就可以回退到未做这些修改 ...

  5. git的学习笔记(二):git远程操作

    1.创建ssh key ssh-keygen -t rsa -C "your_email@example.com" 执行命令后会在用户的家目录生成.ssh的隐藏文件夹,文件夹里有公 ...

  6. 项目管理---git----快速使用git笔记(一)------git的简单介绍

    最近svn代码管理服务器崩溃了,切换到git来运作. 经过几天的使用,感觉很不错. 尤其是代码合并到正式版本之前 可以对代码进行 code review. 这样能很好的保证团队的代码质量和一些重复代码 ...

  7. 笔记:git和码云

    背景:之前使用GitHub,无奈网速原因,有时候竟无法连接,搜索解决方案而又鱼龙混杂淹没在信息的海洋. 于是尝试码云,界面简单,全中文,用起来很是顺手. 码云使用git来管理,操作上都是git的基本指 ...

  8. 【学习笔记】Git的日常使用

    Note:本笔记是我学习廖雪峰老师的Git教程整理得到,在此向廖老师的无私付出表示衷心的感谢! 0.Git的历史 Git是一个分布式的版本控制系统(C语言编写,一开始为Linux社区服务,替代BitK ...

  9. 【笔记】Git简明教程

    前言 Git这个东西我曾经有学过,但学的内容太多了,有点懵,不太理解,磕磕碰碰的,走了不少弯路.不过最近我在B站上发现了一个讲的很好的教程:<表严肃讲Git>.因此,我决定用文字的方式分享 ...

随机推荐

  1. Deepin 自动挂载win NTFS磁盘

    安装了双系统 WIN10+Deepin15.4,系统开机进入Linux,刚开始在/media/my-PC里面还能看到win系统上的C.E.F盘,系统提示更新后,再次打开/media 看不见NTFS分区 ...

  2. C++ 生成洛伦兹的蝴蝶

    这里使用 C++ 计算轨迹,生成 Python 文件,使用 matplotlib 绘图. // simulator.cpp : 此文件包含 "main" 函数.程序执行将在此处开始 ...

  3. 推荐一款免费的PDF转换工具 | PDFCandy

    相信大家在用的PDF转换工具也很多,下面良心推荐这款软件(PDFCandy)给大家,方便在今后的工作中进行运用.提高大家的工作效率. PDFCandy分为两种:网页端和客户端.(根据大家的喜好度来进行 ...

  4. macof python攻击脚本

    #!/usr/bin/python import sys from scapy.all import * import time iface="eth0" if len(sys.a ...

  5. DWM1000 帧过滤代码实现

    帧过滤功能可以在同一个环境内组建多个网络而不干扰(非频段不同),可以通过PANID(网络ID)区分不同网络,不同网络中的模块无法直接通信, 再之,利用短地址,网络中可以同时有多个模块发送信息,而接收端 ...

  6. Linux Kernel C语言编程范式

    介绍 不同的编程语言具有不同的抽象原语(如下),有的原语抽象层次低,有的原语抽象层次高.其中函数式.DSL是这几年十分热门的编程语言概念. 过程式抽象原语:变量 对象式抽象原语:对象 函数式抽象原语: ...

  7. FTP连接虚拟主机响应220 Welcome to www.net.cn FTP service. (解决的一个问题)

    问题场景: 使用FTP客户端连接虚拟主机时,同样的账号密码在有的网络下可以连接成功,有的网络下却一直连接不上:ftp响应“220 Welcome to www.net.cn FTP service.” ...

  8. jquery ajax中success与complete的执行顺序

    jquery ajax中success与complete的执行顺序 jquery中各个事件执行顺序如下: 1.ajaxStart(全局事件) 2.beforeSend 3.ajaxSend(全局事件) ...

  9. 20181115 python-第一章学习小结part2

    Python基本知识 变量,用来存储中间计算结果,在后面可进行调用被使用的东西,叫做变量. 变量的命名规则: 字母,数字,下划线组合 不能用数字开头 常见的关键字不能用啊 常量,不会变的量,称作常量. ...

  10. [jzoj]3468.【NOIP2013模拟联考7】OSU!(osu)

    Link https://jzoj.net/senior/#main/show/3468 Description osu 是一款群众喜闻乐见的休闲软件. 我们可以把osu的规则简化与改编成以下的样子: ...