2013-03-15 61 views

回答

11

您可以使用Git的GIT_TRACEenvironment variable來獲取執行的命令的詳細跟蹤。例如:

GIT_TRACE=true git flow feature start bar 

... ...顯示

trace: exec: 'git-flow' 'feature' 'start' 'bar' 
trace: run_command: 'git-flow' 'feature' 'start' 'bar' 
trace: built-in: git 'config' '--get' 'gitflow.branch.master' 
trace: built-in: git 'branch' '--no-color' 
trace: built-in: git 'config' '--get' 'gitflow.branch.develop' 
trace: built-in: git 'branch' '--no-color' 
trace: built-in: git 'config' '--get' 'gitflow.branch.master' 
trace: built-in: git 'config' '--get' 'gitflow.branch.develop' 
trace: built-in: git 'config' '--get' 'gitflow.branch.master' 
trace: built-in: git 'config' '--get' 'gitflow.branch.develop' 
trace: built-in: git 'config' '--get' 'gitflow.origin' 
trace: built-in: git 'config' '--get' 'gitflow.prefix.feature' 
trace: built-in: git 'branch' '--no-color' 
trace: built-in: git 'branch' '-r' '--no-color' 
trace: built-in: git 'branch' '--no-color' 
trace: built-in: git 'branch' '-r' '--no-color' 
trace: built-in: git 'checkout' '-b' 'feature/bar' 'develop' 
Switched to a new branch 'feature/bar' 

Summary of actions: 
- A new branch 'feature/bar' was created, based on 'develop' 
- You are now on branch 'feature/bar' 

Now, start committing on your feature. When done, use: 

    git flow feature finish bar 

如果你想比這更多的細節,你可以使用sh shellxtrace選項:

展開每個簡單的後命令,用於命令,大小寫命令,選擇命令或算術命令,顯示PS4的擴展值,後跟命令及其擴展參數或相關單詞列表。

編輯git-flow腳本並在#!/bin/sh第一行之後加上set -x。執行上述命令,git flow feature start bar將顯示大量信息(超過可以包含在答案中)。

+0

NEATO!每天學些新東西... – the0ther 2015-05-14 20:11:44

1

通過檢查the source可以看到每個命令的功能。它有很好的文檔記錄,所以即使不知道bash,你也可以瞭解發生了什麼。

實際上,在檢查源代碼後,似乎確實有辦法記錄git流在內部使用的命令;至少大部分是。該功能被引入with this commit和提示show_commands設置。您應該可以使用--show_commands啓用它,它會打印出大多數內部使用的git命令。

1

使用--showcommands開關,例如:

git flow feature start FEATURENAME --showcommands 
相關問題