LoginSignup
1
1

More than 5 years have passed since last update.

Mac OS で git の環境構築用メモ

Posted at

SourceTree

Tools

zsh 上で

brew install hub
go get github.com/motemen/ghq && cd ghq && sudo make install && cd .. && rm -rf ghq

Config

~/.gitconfig

[push]
        default = simple
[credential]
        helper = osxkeychain
[alias]
        graph = log --graph --date=short --decorate=short --pretty=format:'\t%Cgreen%h %Creset%cd %Cblue%cn %Cred%d %Creset%s'
        gr = log --graph --date=short --decorate=short --pretty=format:'\t%Cgreen%h %Creset%cd %Cblue%cn %Cred%d %Creset%s'
        ci = commit --allow-empty
        co = checkout
        stat = status
        st = status
        whom = show --date=short -s --format=\"%Cgreen%h %Creset%cd %Cblue%cn %Creset%s\"
        all-branch = branch --all --verbose
[merge]
        ff = false
[ghq]
        root = 'path-to-root'
git config --global core.editor 'subl -n -w'

cat <<__EOF > ~/.zsh/git.zsh
function peco-src () {
  local selected_dir=$(ghq list -p | peco --query "$LBUFFER")
  if [ -n "$selected_dir" ]; then
    BUFFER="cd ${selected_dir}"
    zle accept-line
  fi
  zle clear-screen
}
zle -N peco-src
bindkey '^]' peco-src
__EOF

cat <<__EOF > ~/bin/peco-sha
#!/usr/bin/env zsh
peco --prompt 'Get SHA of >' | head -n 1 | perl -ne'/([0-9a-f]{6,})/ and print \$1;'
__EOF

chmod +x ~/bin/peco-sha
1
1
0

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
1
1