[英]git log pretty format for a certain branch
我正在嘗試使用 git log pretty format 命令將日志輸入到 json 文件中。 目前我正在使用這個命令來獲取特定的 git 屬性:
git log --pretty="format:{commit:%h,%n merge:%p,%n author:%an,%n title:%s,%n body:%b,%n}">git_log.json
該命令的問題在於它獲取系統中所有分支的日志並輸入到 json 中。 我只想使用這個命令來輸入我可以以某種方式輸入的某個分支的日志。
我嘗試檢查我想要注銷的某個分支,然后使用該命令但它不起作用,因為它仍然顯示所有現有分支的日志。 這是我在 cmd 行中的失敗嘗試:
git checkout robotics/ashish_c/infrastructure
git fetch
git log --pretty="format:{commit:%h,%n merge:%p,%n author:%an,%n title:%s,%n body:%b,%n}">git_log.json
但它也給了我其他分支的日志文件。 如何僅獲取分支機器人/ashish_c/infrastructure 的漂亮格式日志文件?
該命令的問題在於它獲取系統中所有分支的日志並輸入到 json 中。
那不應該是這樣。 git log
獲取當前簽出的提交的日志及其歷史記錄。 git log --all
獲取所有分支的日志。
Git 歷史不是線性的,看起來您正在獲取已合並到當前提交中的其他分支的歷史。 git log --graph --decorate
將向您展示真實的歷史。
如何僅獲取分支機器人/ashish_c/infrastructure 的漂亮格式日志文件?
git log robotics/ashish_c/infrastructure
我正在嘗試使用 git log pretty format 命令將日志輸入到 json 文件中。
JSON 鍵和字符串必須被引用。 我刪除了換行符以簡化事情,這不是供人類使用的。 而是嘗試...
git log --format='{"commit":"%h", "merge": "%p", "author": "%an", "title": "%s", "body":"%b"},' > git_log.json
但這使您沒有包裝[]
和尾隨,
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.