發表文章

目前顯示的是有「Git」標籤的文章

Windows 上使用 Meld 進行 git-diff

圖片
[Git Bash] git config --global difftool.meld git config --global difftool.meld.path "C:\Program Files (x86)\Meld\Meld.exe"

Git - 同時 push 到多個 remote

倘若 Repository 中有多個 Remote 而且希望一次 push 操作同時丟到多個 Remote 上,可以輸入以下指令來編輯 config : $: git config -e 先前你如果已經設定好偏好的編輯器,則會使用設定好的編輯器進行編輯 。在檔案下方建立一個新的 Entry ,例如: [remote "all"] url=ssh://user@server/repos/g0.git url=ssh://user@server/repos/g1.git 然後 push 改指定 all 這個 Remote 名稱,就會發現同時丟往這兩個位置了!

如何更改 Git config 的編輯器

執行 git config -e ,預設是打開 GNU Nano 編輯器,不過操作上不太順手,可以更改設定,改為自己喜歡的編輯器: $: git config core.editor <editor name> 編輯器可以是任意的,環境變數中找得到的,如果沒有就要自己加進去。

Git - Diff 的小技巧,只比較特定檔案

        一般來說,git-diff 會把所有追蹤中的檔案差異顯示出來,如果我們只要顯示 *.c 副檔名的檔案差異呢? $: git diff --name-only <branch> -- '*.c'         如此一來,就會限制輸出C檔案的差異!其中 --name-only 是為了突顯出有哪些檔案有差異,而查看差異內容。

Git - 指定 Branch 匯出原始碼不含版本控制資訊

匯出 master 的內容並打包:   $ git archive master | tar -x -C /somewhere/else 指定特定格式,匯出然後壓縮,如匯出成 *.zip:   $ git archive --format zip --output /full/path/to/zipfile.zip master