Grüezi,
使いたい時には忘れてるGit commandをメモ代わりにalias化しました.
~/.gitconfig
に下記コードを保存すると,terminalでgit [alias]
でgit コマンドとして使えます.
大体これで作業順な気がする.
[alias] rv = remote -v ra = remote add origin # for setting remote repo, paste remote URL br = branch #show branch cb = checkout -b #create and switch branch c = checkout #switch branch s = status d = diff #show diff between main and current branch dd = diff --name-only #show diff between main and current branch as file name l = log --oneline ad = add . com = commit -m # with "commit comment" cm = checkout main # switch to main branch m = merge # merge branch into current branch bd = branch -d #delete branch
cloneとかpullした後のbranchがmaster
ではなくmain
になってるので注意.
このaliasでgit commit -m
は,
git com 'comment etc.'
みたいにquate使った方が,スペース使ってもerrorが出ない.
これらのaliasはtab
で補完されないので注意.
忘れた時はそれっぽくわざと間違うと,
git: 'co' is not a git command. See 'git --help'. The most similar commands are commit com
みたいに教えてくれる.
git --help
ではaliasまで表示しないけど,git help -a
だと一応一番下には表示される.けど,見つけづらいので非推奨.
cat ~/.gitconfig
こちらはcat ~/.git
まで覚えておけばtab
で補完もしてもらえるし,terminal上でalias一覧を確認出来るので便利かも.
.zshrc
周りをいじるのに抵抗がなければ,
alias b='git branch' alias rv='git remote -v' alias ra='git remote add origin' # for setting remote repo, paste remote URL alias b='git branch' #show branch alias cb='git checkout -b' #create and switch branch alias c='git checkout' #switch branch alias s='git status' alias d='git diff' #show diff between main and current branch alias ddd='git diff --name-only' #show diff between main and current branch as file name alias l='git log --oneline' alias ad='git add .' alias com='git commit -m' # with "commit comment" alias cm='git checkout main' # alias m='git merge' # merge branch into current branch alias bd='git branch -d' #delete branch
を追記すると,git
すら入力する必要がなくなる.(動作保証はしませんが)
.gitignore
Git管理下のparent directoryに置いておく隠しテキストファイル. Git管理対象外のFile名を指定出来る.
*.sdf *.smi *.cif *.pdb *.pse .ipynb_checkpoints
chemoinfoクラスタは辺りはdefaultでGit管理から外しておかないと大変になりそう.
git diff
周りがちゃんと理解出来てないので,そのうち追記していきます.