LoginSignup
80
63

More than 3 years have passed since last update.

何も考えずMac上のGit diffでExcelの差分を見れるようにする

Last updated at Posted at 2016-02-17

エクセルをgit管理する際に困るのが、差分が見れない点。
本当はエクセル使いたくないけど、
誰でも使えて必要な機能が揃うエクセル最強説。
代替がなく辛い。

ということで、少しでも事故を減らしたり、
調査を素早くする第一歩として、
自分のMacだけでも差分を見れるようにしようという試みです。

手順

とにかく環境設定の手間を最小限にするため、
何も考えずグローバルに設定します。
一度設定すればリポジトリごとの設定等は不要です。

goをインストール

~$ brew install go

GOPATHの設定

パッケージをインストールするディレクトリを作成して設定

~$ mkdir .go
~/.bash_profile
export GOPATH=$HOME/.go
~$ source .bash_profile

goのパッケージ取得

~$ go get github.com/tokuhirom/git-xlsx-textconv

gitconfigの設定

グローバルのgitconfigに以下を追加

~/.gitconfig
[diff "xlsx"]
    binary = true
    textconv = $GOPATH/bin/git-xlsx-textconv

gitattributesの設定

.gitattributesを新規作成

~/.gitattributes
*.xlsx  diff=xlsx
*.XLSX  diff=xlsx

gitconfigに設定を追加

~$ git config --global core.attributesfile ~/.gitattributes

参考

80
63
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
80
63