0%

detached HEAD is a common situation, sometimes useful, sometimes dangerous. It doesn’t point to any branches, so it will be cleaned by git.

The current commit history is as follows:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$ git log --oneline --all --graph
* 5ea3cec (HEAD -> master) Modify README.md of src
* 2b6e826 Same file, same blob
* 1ff08f2 Modify README.md.
* 8c19a38 Add Copyright notice.
* 318c11a Copy css to lib.
| * 1134f9e (dev) Make graph more readability
| * 71c40d3 Modify README.md in dev branch.
|/
* ce4297f Add image.
| * 2cb23ac (dev-1.0) README for dev-1.0 branch.
|/
* 6fc4b44 (tag: kikoff_tag) Copy doc README.md
* 726c6c0 Add source README.md
* c8ff9c5 Add README
Read more »

.git directory acts a major role in git VCS. We can do local verson management directly depended on .git directory. I will parse .git in current topic.

Directory tree

First, I created a project and managed it through git, its directory tree is as follows:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
.
├── doc
│   └── README.md
├── .git
│   ├── COMMIT_EDITMSG
│   ├── config
│   ├── description
│   ├── HEAD
│   ├── hooks
│   │   ├── applypatch-msg.sample
│   │   ├── commit-msg.sample
│   │   ├── fsmonitor-watchman.sample
│   │   ├── post-update.sample
│   │   ├── pre-applypatch.sample
│   │   ├── pre-commit.sample
│   │   ├── prepare-commit-msg.sample
│   │   ├── pre-push.sample
│   │   ├── pre-rebase.sample
│   │   ├── pre-receive.sample
│   │   └── update.sample
│   ├── index
│   ├── info
│   │   └── exclude
│   ├── logs
│   │   ├── HEAD
│   │   └── refs
│   │   └── heads
│   │   ├── dev
│   │   ├── dev-1.0
│   │   └── master
│   ├── objects
│   │   ├── 02
│   │   │   ├── 40351d75b3f451e0ec4b399c38c3758f007152
│   │   │   └── d8eae705ebf203142fd2f381d3b216dde2b28f
| | |...
│   │   ├── c8
│   │   │   └── ff9c55ce2651d8380a14bee5b43b37e14fa7fc
│   │   ├── f0
│   │   │   └── 45488f3fa9a350ac01f48f2b000fe51a53f5aa
│   │   ├── info
│   │   └── pack
│   ├── ORIG_HEAD
│   └── refs
│   ├── heads
│   │   ├── dev
│   │   ├── dev-1.0
│   │   └── master
│   └── tags
│   └── kikoff_tag
├── img
│   └── check.png
├── lib
│   └── css_practice_1.html
├── README.md
└── src
└── README.md
Read more »

Command Interface

We can enter command interface via the following ways.

  1. Excute init 3 with root.

    init run at runlevel 3.

  2. Hotkey: Ctrl + ALt + F1/2/3/…

init

init is the first process, it commonly locates on /sbin/init, if kernel can’t find init, it will try to run /bin/sh, if the operation fails , the OS will fail to start successfully.

init has 7 runlevels, we can check the default runlevel and runlevels in /etc/inittab. As follows:

1
2
3
4
5
6
7
8
9
10
# Default runlevel. The runlevels used are:
# 0 - halt (Do NOT set initdefault to this)
# 1 - Single user mode(root)
# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)
# 3 - Full multiuser mode(standard runlevel)
# 4 - unused(secure mode)
# 5 - X11(user interface)
# 6 - reboot (Do NOT set initdefault to this)
#
id:5:initdefault:
Read more »

在使用 Ubuntu 的时候,有时候会遇到卡死的问题,然后电脑完全不能使用。这时候怎么办呢,我通常是通过如下两种方式进行处理:

Kill process

当我们明确知道什么进程导致系统卡死的时候,譬如文件管理器,我们可以通过如下两种方式进入字符终端找到假死的进程然后 kill 掉。

  1. Ctrl + Alt + F1 进入,Ctrl + Alt + F7 回到 UI 。
  2. ssh user@ip 远程登入。

杀死进程的方式,我常用的有三种,如下:

  1. Top 或者 htop 找到造成假死的进程并 kill
  2. 通过名字或者进程 PID 去杀进程。
    1
    2
    3
    4
    5
    ps -A |grep nautilus  # 查看文件管理器的 PID
    kill PID

    # 以名字的形式杀掉进程
    killall nautilus

Log out

注销桌面重新登录:

1
2
3
sudo pkill Xorg
或者
sudo restart lightdm

Preface

Git has always been a must-have skill for developers, I will submize a series of blogs related to it, although I don’t know too much about git now.

Pro Git is the best guide of git, I need to read it when I have plenty of time so that I can check for gaps.

VCS(Version Control System)

Central VCS

Central VCS mainly includes SVN and CVS, its newwork architecture is client-server.
![Central VCS](/image/vcs/Central VCS.jpg)

Read more »