Tig (text-mode interface for Git) [論壇 - Ubuntu 與工具程式及軟體推薦]


正在瀏覽:   1 名遊客


 到底部   前一個主題   下一個主題  [無發表權] 請登錄或者註冊



Tig (text-mode interface for Git)
會員五級
註冊日期:
2012/4/22 10:50
所屬群組:
已註冊使用者
等級: 36
HP : 179 / 898
MP : 664 / 28634
EXP: 92
離線
剛從「這篇」介紹,發現了一個輔助工具「tig」。

還沒深入使用,先貼相關連結上來 :p

更多參考可以查詢「git tig」或是「tig git」。

這篇討論連結,也一併紀錄到這篇「討論串」。

## 相關連結

* http://jonas.nitro.dk/tig/
* http://jonas.nitro.dk/tig/manual.html
* https://github.com/jonas/tig

* Git Wiki / Git Tools

## Package

* tig

## Manpage

$ man tig
$ man tigrc

## 測試環境

* Xubuntu 16.04 (64位元) 英文界面

## 如何安裝

執行下面指令安裝「tig」這個套件。


$ sudo apt-get install tig



## 觀看Help

執行


$ tig -h



或是執行


$ tig --help



顯示


tig 2.0.2 (Feb 7 2016)

Usage: tig [options] [revs] [--] [paths]
or: tig log [options] [revs] [--] [paths]
or: tig show [options] [revs] [--] [paths]
or: tig blame [options] [rev] [--] path
or: tig grep [options] [pattern]
or: tig stash
or: tig status
or: tig < [git command output]

Options:
+<number> Select line <number> in the first view
-v, --version Show version and exit
-h, --help Show help message and exit



## 觀看版本

執行


$ tig --version



或是執行


$ tig --version



顯示


tig version 2.0.2


2016/10/31 10:19
應用擴展 工具箱
gitg (the GNOME GUI client to view git repositories)
會員五級
註冊日期:
2012/4/22 10:50
所屬群組:
已註冊使用者
等級: 36
HP : 179 / 898
MP : 664 / 28634
EXP: 92
離線
另從「這篇」下面的回覆,發現另一個工具「gitg」,這個是圖形使用者介面工具。

## 相關連結

* GNOME / Gitg


## Package

* gitg

## Manpage

$ man gitg

## 如何安裝

執行下面指令,安裝「gitg」這個套件。


$ sudo apt-get install gitg




## 觀看 Help

執行


$ gitg -h



或是執行


$ gitg --help



顯示


Usage:
gitg [OPTION...] - Git repository viewer

Help Options:
-h, --help Show help options
--help-all Show all help options
--help-gtk Show GTK+ Options

Application Options:
-v, --version Show the application's version
--activity Start gitg with a particular activity
-c, --commit Start gitg with the commit activity (shorthand for --activity commit)
--no-wd Do not try to load a repository from the current working directory
--display=DISPLAY X display to use
-a, --all Select all commits by default in the history activity
-b, --branches Select all branches by default in the history activity
-r, --remotes Select all remotes by default in the history activity
-t, --tags Select all tags by default in the history activity
-s, --select-reference=REFERENCE Select the specified reference by default in the history activity



## 觀看版本

執行


$ gitg -v



或是執行


$ gitg --version



顯示


gitg 3.17.1




以上參考


2016/10/31 10:36
應用擴展 工具箱
git config alias
會員五級
註冊日期:
2012/4/22 10:50
所屬群組:
已註冊使用者
等級: 36
HP : 179 / 898
MP : 664 / 28634
EXP: 92
離線
## 緣起

從查詢「git tig」或是「tig git」查到的下面兩篇文章。

* Git - 列出樹狀結構的 Log
* Tig:給 Git 用的文字介面套件

上面這兩篇,有提到設定「Git Alias」的方式,講的概念是一樣的。

## Config file location

先討論「Config file location」

* 系統痊癒的設定檔路徑是「/etc/gitconfig」
* 個人全域的設定檔路徑是「~/.gitconfig」
* 個別專案的設定檔路徑,則是在該專案的「.git/config」

可以執行下面指令,看到相關的簡易說明


$ git config -h



顯示


usage: git config [<options>]

Config file location
--global use global config file
--system use system config file
--local use repository config file
-f, --file <file> use given config file
--blob <blob-id> read config from given blob object
...略...



或是執行「$ man git-config」,可以看到更詳細的說明。

執行「$ git config --help」或是執行「$ git help config」,則是跟執行「$ man git-config」看到的內容是一樣的。


以上面兩篇提到的案例來舉例說明

## git config --global

執行下面指令


$ git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative"



「git config」有加入「--global」,就可以在「~/.gitconfig」看到剛剛的設定。

執行下面指令,觀看「~/.gitconfig」的內容。


$ cat ~/.gitconfig



顯示


[alias]
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative



執行下面的指令,則是可以看到剛剛的設定。


$ git config --global alias.lg



顯示


log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative



上面alias的設定,只要執行「git lg」就可以看到效果。

## git config --local

執行


$ git config alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative"



當執行「git config」若沒有加入「--global」,則是在該專案的「.git/config」看到剛剛的設定。


$ cat .git/config



一樣可以找到上面的設定。


## git config --system

執行「git config」另外還有一個「--system」的參數

所以執行


$ sudo git config --system alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative"



上面記得加上「sudo」,否則會看到提示訊息「error: could not lock config file /etc/gitconfig: Permission denied」

執行下面指令,觀看「/etc/gitconfig」


$ cat /etc/gitconfig



一樣可以找到上面的設定。

## Source Package

* git

## Package

* git
* git-man
* git-doc
* git-gui
* gitk
* ...

## Manpage

$ man git-config
$ man git-log
$ man git-help
$ man gittutorial
$ man gittutorial-2

## Git Reference

* git-config
* git-log
* PRETTY FORMATS
* git-help
* gittutorial
* gittutorial-2

## Git Manual

* git-config
* git-log
* git-help
* gittutorial
* gittutorial-2

## Pro Git book

* 8.1 Customizing Git - Git Configuration
* 2.7 Git Basics - Git Aliases
* 1.7 Getting Started - Getting Help

## Git Wiki

* Git Documentation
* QuickStart

## 更多參考

* Ubuntu Server Guide / Version Control System / Git
* Debian Wiki / UsingGit
* Arch Wiki / Git

2016/10/31 18:05
應用擴展 工具箱


 [無發表權] 請登錄或者註冊


可以查看帖子.
不可發帖.
不可回覆.
不可編輯自己的帖子.
不可刪除自己的帖子.
不可發起投票調查.
不可在投票調查中投票.
不可上傳附件.
不可不經審核直接發帖.