我的站点

一个系统软件工程师的随手涂鸦

Date: 九月 7, 2015

*NIX & Hacking —— 第8期

做一本我感兴趣的杂志,就这么简单!

C

C Programming Substance Guidelines
The International Obfuscated C Code Contest

Docker

A Beginners Guide to Docker and Containers

Gcc

About GCC printf optimization

Git

Git Cheat Sheet
Git Tips

Hardware

Interfacing the Serial / RS232 Port

Kernel

Porting Linux to a new processor architecture, part 1: The basics
The newbie’s guide to hacking the Linux kernel
Writing a Linux Kernel Module — Part 1: Introduction

Lua

Embedding LuaJIT in 30 minutes (or so)

Network

Mobile TCP optimization – lessons learned in production

Unix

The First Port Of Unix

git小技巧(8)——“git checkout – ”

git checkout -切换到之前工作的branch。请看例子:

[root@localhost debugging-stories]# git branch
  master
  patch-1
* patch-2
[root@localhost debugging-stories]# git checkout -
Switched to branch 'patch-1'
[root@localhost debugging-stories]# git branch
  master
* patch-1
  patch-2

可以看到切换到了patch-1 branch

 

git branch & merge笔记

In fact, in Git, the act of creating a new branch is simply writing a file in the .git/refs/heads directory that has the SHA-1 of the last commit for that branch.

Creating a branch is nothing more than just writing 40 characters to a file.

Switching to that branch simply means having Git make your working directory look like the tree that SHA-1 points to and updating the HEAD file so each commit from that point on moves that branch pointer forward (in other words, it changes the 40 characters in .git/refs/heads/[current_branch_name] be the SHA-1 of your last commit).

可以看到,在git中,创建一个branch仅仅是在一个文件中加入40个字符的SHA-1值。

Remotes are basically pointers to branches in other peoples copies of the same repository, often on other computers. If you got your repository by cloning it, rather than initializing it, you should have a remote branch of where you copied it from automatically added as origin by default. Which means the tree that was checked out during your initial clone would be referenced as origin/master , which means “the master branch of the origin remote.”

Remotes是指向其它人关于这个repository copy里某个branch的指针。如果你的repository是通过clone其它copy得到的,而不是initialize的,在你的repository里,会自动产生一个origin/masterremote branch指向你copyrepository tree

参考资料:
Git internals

Powered by WordPress & Theme by Anders Norén