Git でJSON を整形して比較できるらしいのでメモ。JSON だけでなく Word や ODT、 Jpeg や PNG なども
実ファイルを比較時に変換させることができるみたいです。
参考
Git - Git AttributesGit - gitattributes Documentation
設定
*.json diff=json
[diff "json"] textconv = "jq ."
Git でJSON を整形して比較できるらしいのでメモ。*.json diff=json
[diff "json"] textconv = "jq ."
peco を導入しました。すごく便利です。function peco-git-changed-files(){
git status --short | peco | awk '{print $2}'
}alias -g F='$(peco-git-changed-files)'
function peco-git-hash(){
# git log --oneline --branches | peco | awk '{print $1}'
git lg | peco | sed -e "s/^[\*\|][ |\\\/\*]*//g" | awk '{ print $1 }'
}alias -g F='$(peco-git-hash)'
[alias] lg = log --all --graph --decorate --onelinegit lg (log graph) は僕の git log を置き換えるコマンドです。

function peco-git-branch(){
git branch | peco | sed -e "s/^\*[ ]*//g"
}alias -g B='$(peco-git-branch)'
Git のリモートブランチを全て pull したいことがあっても#!/bin/bash
for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v master `; do
git branch --track ${branch#remotes/origin/} $branch
done
Homebrew の更新の度にマージコミットで中断されてめんどくさかったので[merge]
ff = false
[pull]
ff = only
fatal: Not possible to fast-forward, aborting. Error: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master Error: Command failed: L2:brew updateはい、明らかに git pull でエラーになりました。
fatal: Not possible to fast-forward, aborting. Error: Failed to update tap: caskroom/cask fatal: Not possible to fast-forward, aborting. Error: Failed to update tap: caskroom/versions以下のコマンドを実行して再インストールしてあげれば履歴が綺麗になって動きます。
Git の pull / merge が --no-ff だと
GitHub で2段階認証の設定をしてから push 時に認証が失敗するようになりました。Two-factor Authentication実際に push 時にパスワードではなくアクセストークンを入力してみると問題なく push することができます。
How does it work for command-line Git?
If you are using SSH for Git authentication, rest easy: you don't need to do
anything. If you are using HTTPS Git, instead of entering your password, enter
a personal access token. These can be created by going to your
application settings page.
% git remote set-url origin git@github.com:wada811/AndroidLibrary-wada811.git % git remote -v origin git@github.com:wada811/AndroidLibrary-wada811.git (fetch) origin git@github.com:wada811/AndroidLibrary-wada811.git (push)参考: Githubの2段階認証を有効にしてgitからの認証が弾かれる時の話 - 頼りないニモニック
machine github.com login wada811 password xxxpersonalaccesstokenxxxコレが一番楽な解決方法ですね。
ドットファイルと呼ばれるファイル名の先頭にドットがある設定ファイル(※)をcd ~ mkdir dotfiles
mv .gitconfig dotfiles mv .gitignore dotfiles mv .vim dotfiles mv .vimrc dotfiles mv .zsh dotfiles mv .zshrc dotfiles
cd dotfiles vi dotfilesInstaller.sh
#! /bin/bash ln -s ~/dotfiles/.gitconfig ~/.gitconfig ln -s ~/dotfiles/.gitignore ~/.gitignore ln -s ~/dotfiles/.vim/ ~/.vim ln -s ~/dotfiles/.vimrc ~/.vimrc ln -s ~/dotfiles/.zsh/ ~/.zsh ln -s ~/dotfiles/.zshrc ~/.zshrc
chmod +x dotfilesInstaller.sh ./dotfilesInstaller.sh
git init hub create git add . git commit -m "Initial commit" git push -u origin master
cd ~ git clone git@github.com:wada811/dotfiles.gitclone したら dotfiles フォルダの dotfilesInstaller.sh を以下のように実行したら移行完了です。
chmod +x dotfilesInstaller.sh ./dotfilesInstaller.sh
#!/bin/sh
cd $(dirname $0)
for dotfile in .?*
do
if [ $dotfile != '..' ] && [ $dotfile != '.git' ]
then
ln -Fis "$PWD/$dotfile" $HOME
fi
doneDotfilesをGitHubで管理する | fixture.jp
[Git][GitHub]Pull Request を送る手順、あるいは GPUImage for Android に PullRequest を送った話 | DevAchieve を書く際に色々調べていたらhub clone octocat/Spoon-Knifecd Spoon-Knifegit checkout -b Spifevi README.mdgit add README.mdgit commit -m "Spife is spoon, it's also knife."hub forkgit push wada811 Spifehub pull-request
CyberAgent/android-gpuimageを使ってみたらgit clone git@github.com:octocat/Spoon-Knife.gitcd Spoon-Knifegit checkout -b Spifevi READMEgit add READMEgit commit README -m "Spife is a spoon, it is also a knife."git remote add upstream git://github.com/octocat/Spoon-Knife.gitgit stashgit checkout mastergit pull upstream mastergit checkout Spifegit rebase master Spifegit stash popgit checkout Spifegit checkout -b featureSpifegit rebase -i mastergit push origin featureSpife
Git の diff を美しく表示するために必要なたった 1 つの設定 #gitという記事を見て、You may wish to `brew unlink` these brews:
opensslのように言われたのですがいらないのがいくつかあったのでYou should `brew install` the missing dependencies:
brew install readlineのように言われたので brew install readline を実行しました。Error: Homebrew doesn't know what compiler versions ship with your version of Xcode. Please file an issue with the output of `brew --config`: https://github.com/mxcl/homebrew/issues Thanks!のように言われていたので Xcode と Command Line Tools をアップデートしました。
git version 1.8.4.3
[pager] log = diff-highlight | less show = diff-highlight | less diff = diff-highlight | less文字列単位の差分がある場合は差分にハイライトされたように背景がつきます。
Androidアプリ作ってるよー!カメラアプリでプレビューが歪むよー!# built application files *.apk *.ap_ # files for the dex VM *.dex # Java class files *.class # generated files bin/ gen/ # Local configuration file (sdk path, etc) local.properties # Eclipse project files .classpath .project # Proguard folder generated by Eclipse proguard/ # Intellij project files *.iml *.ipr *.iws .idea/gitignore/Android.gitignore at master · github/gitignore · GitHub
# Compiled source # ################### *.com *.class *.dll *.exe *.o *.so # Packages # ############ # it's better to unpack these files and commit the raw source # git has its own built in compression methods *.7z *.dmg *.gz *.iso *.jar *.rar *.tar *.zip # Logs and databases # ###################### *.log *.sql *.sqlite # OS generated files # ###################### .DS_Store .DS_Store? ._* .Spotlight-V100 .Trashes Icon? ehthumbs.db Thumbs.dbgit config --global core.excludesfile ~/.gitignore で設定する。
zshでgitのコマンドやブランチ名を補完できるようにする - QNYP Blogを見て、/Users/wada/.zsh/completion ├── _git └── git-completion.bash 0 directories, 2 filesと、tree とか出てきて、なにこれ便利!いいな!と思ったらbrew install treeで使えるようになります。
fpath=(~/.zsh/completion $fpath) autoload -U compinit compinit -urm -f ~/.zcompdump; compinitもした方が良いらしい。
MacにHomeBrewとzshを導入してみた | DevAchieveでログインシェルを zsh に# zsh補完を有効化 fpath=(/usr/local/share/zsh-completions $fpath)変更した .zshrc の設定を有効にする。
git version 1.7.9.6 (Apple Git-31.1) hub version 1.10.2こんな感じに出ればOK!
mkdir Sample cd Sample git init hub create初回はID/PWを尋ねられるので答えたらリポジトリが作られる。
@sys1yagi .DS_Store をリポジトリに入れたいことはたぶん無いと思うので git の global な設定で ignore してる。help.github.com/articles/ignor… に書いてある Global .gitignore のやり方で
— @zaki50 ♎さん (@zaki50) 2012年12月19日Ignoring files · github:help# Compiled source # ################### *.com *.class *.dll *.exe *.o *.so # Packages # ############ # it's better to unpack these files and commit the raw source # git has its own built in compression methods *.7z *.dmg *.gz *.iso *.jar *.rar *.tar *.zip # Logs and databases # ###################### *.log *.sql *.sqlite # OS generated files # ###################### .DS_Store .DS_Store? ._* .Spotlight-V100 .Trashes Icon? ehthumbs.db Thumbs.db
@vvakame つ Githubへのpushでusername/passwordを省略する方法2つ shoken.hatenablog.com/entry/20120629…
— Kazuyuki Hondaさん (@hakobera) 2012年8月14日machine github.com login wada811 password xxxxxxx
先に言ってしまうとWindows7 64bitだからといってほとんど違いはありません。
このようなアイコンのやつを実行すると
ライセンスに同意します。
保存場所を指定します。
64bitだとContext menu entriesの方が
スタートメニューに追加
普通は"Use Git Bash only"にしておいた方が良いとか。(参考:Windows版git & TortoiseGit のインストール - Linux & Development Diaries)
チェックアウト時の改行コードの設定。
セットアップウィザードの終了。