git tutorial

Git Object Types - A directed acyclic graph

  • blob
  • tree
  • commit
  • tag

HEAD means the newly commit of current branch
HEAD~1
HEAD~2
HEAD~3
HEAD^
HEAD~1^1
HEAD~1^2


Common Usage:

A:
$ git commit -a -m 'Push Temp'
$ git pull --rebase origin master

# Fix Conflict

$ git reset HEAD~1


B:
$ git stash --include-untracked
$ git pull --rebase origin master
$ git stash pop

# Fix Conflict & merge

C:


git merge-file
http://git-scm.com/docs/git-merge-file


Tutorial on Git / 白話文Git教學http://thoy.blog.ntu.edu.tw/2011/05/01/tutorial-on-git-%E7%99%BD%E8%A9%B1%E6%96%87git%E6%95%99%E5%AD%B8/


Git Tutorial 教學
http://www.slideshare.net/ihower/git-tutorial-13695342


寫給大家的Git教學
http://www.slideshare.net/littlebtc/git-5528339


Git 版本控制系統 (1)(2)(3)http://ihower.tw/blog/archives/2591http://ihower.tw/blog/archives/2620http://ihower.tw/blog/archives/2622

Remember

Remember

2012/11/12



Start .

mmap vs munmap

除錯, Debug, syslog, GDB, gprof

DEBUG MACRO

e.g.

#define BASIC_DEBUG 1
#define EXTRA_DEBUG 2
#define SUPER_DEBUG 4

#if (DEBUG & EXTRA_DEBUG)
.................
#endif


  • Use the compiler to define the DEBUG such as -DDEBUG=5

assert

善用assert巨集,判斷程式執行正確。assert 會將錯誤資訊送到stderr,隨後呼叫abort終止程式

e.g.
#include <assert.h>
void assert(int expression);

利用NDEBUG來定義assert這個巨集,如果NDEBUG被定義,就會取消assert定義。所以在編譯過程中,如果加上-DNDEBUG或是在程式碼assert.h之前加入 #define NDEBUG,就會關閉assertion的動作

syslog

當程式無法將錯誤訊息輸出到stdout 或是 stderr 時,善用syslog

e.g.
#include <syslog.h>
void syslog(int priority,char *format,...);
void openlog( char *ident, int option, int  facility);
void closelog( void );

GDB


e.g.

  1. gcc -g -o xxx xxx.c
  2. gdb
  3. (gdb)file ./xxx
  4. r


e.g.
  1. gcc -g -o xxx xxx.c
  2. gdb --args ./add 3 5
  3. r

e.g.

core dump,檔案名稱為core,這是程式的記憶體映像


  • r = (run)執行一個程式
  • bt = (backtrace)堆疊追蹤
  • p = (print)檢驗變數
  • l = (list)程式列表
  • b = (break)設定中斷點
  • c = (cont)讓程式繼續執行
  • display 程式在遇到中斷點而停止時,自動顯示陣列數值

  • commands ... end 指定一些命令,這些命令會在遇到中斷點時被執行
  • info display 查看display的狀況
  • info break 查看中斷點的狀況
  • disable break 1  暫停中斷點1


gprof

Use gprof to profiling C program on Ubuntu 12.04

e.g.

  1. gcc -pg xxx.c -o xxx
  2. ./xxx          # it will generate gmon.out at this step
  3. gprof xxx gmon.out > xxx.gprof          # use gprof to generate document
  4. vim xxx.gprof


ctags

cxref

cflow

ElectricFence Library - 記憶體除錯

**Valgrind - 偵測陣列錯誤存取與記憶體除錯

e.g.

$ valgrind --leak-check=yes -v ./add_vec

相關文件

Virtual Host

1)sudo vim /etc/apache2/httpd.conf

VirtualHost
    ServerName xxxxxxxxxxxx_url
    DocumentRoot /var/www/xxx
/VirtualHost

2) sudo /etc/init.d/apache2 restart