LoginSignup
13
14

More than 5 years have passed since last update.

.gitconfigの設定とかよく使う便利なコマンドメモ

Last updated at Posted at 2015-06-05

はじめに

  • 僕の.gitconfigの設定か、よく使うコマンドとかをまとめていきます
  • 適当に思いついたところから書いていきます
  • OS: Mac OS Yosemite

Config

エディタの設定

[core]
    editor = emacs

globalなgitignoreの設定

.gitconfig

[core]
    excludesfile = ~/.gitignore_global

.gitignore_global

emacsの一時ファイルとか除外したりする設定なので、この辺はお好みで

*~
\#*\#
.*

ユーザ

草を生やすために設定しておきませう。

[user]
    name = xxxx
    email = xxxx@xx.xx

merge --no-ff をデフォにするための設定

[merge]
    ff = false

出力に色をつける

[color]
    ui = true

エイリアス

[alias]
    st = status
    cm = commit
    cmm = commit -m
    co = checkout
    b = branch
    cb = checkout -b
    sm = submodule
    p = push

コマンド

addしてしまったファイルを取り消す

git resset HEAD <filename>

コミットしてしまったファイルを管理対象から外す

  • --cached を入れないとファイル自体が消えてしまうので注意
git rm --cached <filename>
  • .gitignore を元に管理対象から外す場合
git rm --cached `git ls-files --full-name -i --exclude-from=.gitignore`
13
14
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
13
14