Source: http://www.liaoxuefeng.com/

Here only the local part.

Install on windows

# Set name and email.
$ git config --global user.name "Your Name"
$ git config --global user.email "email@example.com"

Establish repository

# Making an empty directory
$ mkdir learngit
$ cd learngit
# display current working directory
$ pwd
# Making the current directory a Git-managed one. Don't change the directory
# .git (version repository)
$ git init
Initialized empty Git repository in /Users/michael/learngit/.git/
$ ls -ah # list hide folders

Add files into the repository

# Add files into current working directory
$ git add readme.txt
# Add annotations of this submission
$ git commit -m "wrote a readme file"
# Submit multiple files at one time
# Actually, *add* operation is to submit the file to *stage* (working area,
# store the files currently worked on) in the repository (/.git), and
# *commit* will move the ones from *stage* to current branch (git will
# automatically create one named *master* for us (*HEAD* is a pointer
# pointing to master).
$ git add file2.txt file3.txt
$ git commit -m "add 3 files."
# Check the differences between the most recent file in the repository and
# the one in stage.
$ git diff HEAD -- readme.txt

Change the files in the repository

# Check current status of the file
$ git status readme.txt
# Check the changes
$ git diff readme.txt
# If the changes agreed
$ git add readme.txt
$ git commit -m "One change"

Version swap

# Check history changes, note that a more clear time line could be seen in GUI
$ git log
$ git log --pretty=oneline
# Swap back to the last version, HEAD^^ denotes the penultimate version, and
# HEAD~100 denotes the last 100th version
$ git reset --hard HEAD^
# Recover recent versions
# If the command window is not closed after swapping back, the newer version
# could be recovered using the commit ID (first few numbers are enough; you
# could look up to it at the log checked before)
$ git reset --hard 3628164
# If the command window has been closed after swapping back, the command below
# could trace command history, thus you could find the commit ID of the newer
# file.
$ git reflog
# Back to the version for most recent *add* or *commit*
$ git checkout -- test.m
# Fetch the file most recently submitted to *master* to *stage*, then repeat
# line above.
$ git reset HEAD test.m

Deletion

# Delete the file directly in the working area
$ rm test.m
# Current status: but the file is not removed from repository
$ git status
# Delete the file from repository
$ git rm test.txt
$ git commit -m "Confirm deletion"
# Or cancel the deletion
$ git checkout -- test.txt

Meet Github的更多相关文章

  1. 搜刮一些开源项目的APP

    iOS完整App资源收集 <iOS完整app资源收集>  <GitHub 上有哪些完整的 iOS-App 源码值得参考?> <GitHub 上有哪些完整的 iOS-App ...

  2. 【原】Github系列之二:开源 一行代码实现多形式多动画的推送小红点WZLBadge(iOS)

    更新日志 V1.2 2015.09.25 1.UITabBarItem badge is supproted; 2.Enable change badge properties when badge ...

  3. Useful for Android the development engineer from Github

    Original:http://sysmagazine.com/posts/216591/ Many plowing on open space Github, I found assemblage ...

  4. 【个人经历】记自己的第一次GitHub开源代码共享经历

    题记: 自己做程序员快三年有余了,感觉自己和刚入职相比确实有了不少进步,当然三年要是不进步那不就傻了吗,有时候我也在想,我在这三年里留下了什么,当然也不是说有多么高尚的想法,就是以后对别人介绍自己的时 ...

  5. 【RS】AutoRec: Autoencoders Meet Collaborative Filtering - AutoRec:当自编码器遇上协同过滤

    [论文标题]AutoRec: Autoencoders Meet Collaborative Filtering (WWW'15) [论文作者]Suvash Sedhain †∗ , Aditya K ...

  6. [转帖]如何获得一个RAC Oracle数据库(从Github - oracle/docker-images) - 本地版 ---暂时未做实验.

    如何获得一个RAC Oracle数据库(从Github - oracle/docker-images) - 本地版 2019-11-09 16:35:30 dingdingfish 阅读数 32更多 ...

  7. Openfire Meetings插件是一个包含各种Jitsi项目(如VideoBridge和Meet)的实现

    Openfire Meetings插件是一个包含各种Jitsi项目(如VideoBridge和Meet)的实现.要创建与Openfire Meetings一起使用的本机客户端,建议使用Jitsi项目提 ...

  8. Github熟悉一

    Code/代码 Commits/提交 Issues/问题 Packages/包装 Marketplace/市场 Topics/话题 Wikis/维基百科 Users/用户 Pull requests/ ...

  9. GitHub 热点速览 Vol.12:不可思议的浏览器 browser-2020 周涨 star 超 3 千

    作者:HelloGitHub-小鱼干 摘要:本周的 GitHub Trending 像极最近的天气,温暖如春突然来个急降温.新晋 GitHub 项目重启屈指可数的模式,好在老项目们表现甚好.比如一周就 ...

随机推荐

  1. C语言实现泛型编程

    泛型编程让你编写完全一般化并可重复使用的算法,其效率与针对某特定数据类型而设计的算法相同.在C语言中,可以通过一些手段实现这样的泛型编程.这里介绍一种方法——通过无类型指针void* 看下面的一个实现 ...

  2. Java核心:类加载和JVM内存的分配

    类的加载: 指的是将class文件的二进制数据读入到运行时数据区(JVM在内存中划分的) 中,并在方法区内创建一个class对象. 类加载器: 负责加载编译后的class文件(字节码文件)到JVM(J ...

  3. 浅谈Java五大设计原则之观察者模式

    定义一下观察者模式: 观察者模式又叫  发布-订阅  模式,定义的两个对象之间是一种一对多的强依赖关系,当一个对象的状态发生改变,所有依赖它的对象 将得到通知并自动更新(摘自Hand First). ...

  4. IOS 杂笔-1(为什么不继承类簇?)

    答:首先,类簇是可以继承的,并不是不可以.例如,我们可以选择继承NSSting,但是此时你用你自己设定的类去调用NSSting的一些方法时,会存在无法实现的问题,这是为什么呢. 1.类簇里有很多私有的 ...

  5. WPF学习之路(三) 属性与依赖

    类型是DependencyProperty的属性是依赖属性 依赖属性不同于普通的.Net属性,类似于一个计算过程,根据依赖的值得到最终值. 为什么引入依赖属性: MSDN原文 One of the p ...

  6. Netty 异步的、事件驱动的网络应用程序框架和工具

    Netty是由JBOSS提供的一个Java开源框架.Netty提供异步的.事件驱动的网络应用程序框架和工具,用以快速开发高性能.高可靠性的网络服务器和客户端程序. 项目地址:https://githu ...

  7. 初次体验VS2015正式版,安装详细过程。

    本文版权归mephisto和博客园共有,欢迎转载,但须保留此段声明,并给出原文链接,谢谢合作. 文章是哥(mephisto)写的,SourceLink 阅读目录 介绍 安装 其他 本文版权归mephi ...

  8. shell将标准错误输出重定向到 其他地方

    经常可以在一些脚本,尤其是在crontab调用时发现如下形式的命令调用: /tmp/test.sh > /tmp/test.log >& 前半部分/tmp/test.sh > ...

  9. JVM探索之——内存管理(一)

    本系列的第一篇文章,预计本系列最后面会有两三个案例. Java与C.C++不一样Java不需要Coder进行手动内存管理,而这一切都交给JVM进行自动内存管理,这从某种程度上来说也减轻了我们Coder ...

  10. 将u盘的文件复制到虚拟机上的linux系统上面—》文件挂载(文字+图解)

    虚拟机中操作系统.CentOs(无图形界面) 没有图形界面的linux,我也没有配置网络,现在需要把文件复制到linux系统上面,我这里就使用了u盘挂载的方式,获得了U盘中的文件. 1.VMware中 ...