LoginSignup
1

More than 5 years have passed since last update.

.gitconfigのエイリアス

Posted at

.gitconfigに追加しているエイリアス
結構使っていないものも多い

[alias]
    co = checkout
    s = status
    st = status
    d = diff
    dc = diff --cached
    st = status -s -b
    pr = remote prune
    ranking = shortlog -s -n --no-merges
    zip = "!f(){ git archive --format=zip $1 -o $2; };f"

    # checkout
    co = checkout
    dev = checkout develop

    # commit
    cm = commit -a -m
    ca = commit --amend
    cv = commit -v
    cmv = commit -a -v -m
    wip = commit -m "wip"

    # log
    l = log --oneline --graph --decorate
    lp = log --oneline -p

    # branch
    br = branch
    ba = branch -a
    bd = branch -D

    # diff
    d1 = diff HEAD~
    dc = diff --cached
    dd = diff develop
    ddw = diff develop --word-diff
    ddn = diff develop --name-only

    # reset
    rh = reset --hard HEAD
    rs = reset --soft HEAD

    # remote
    #p = "!f(){ git push $1 `git rev-parse --abbrev-ref HEAD`; };f"
    mkf = "!BRANCH=`git rev-parse --abbrev-ref HEAD`; git dev; git pull origin; git co -b feature/${BRANCH}; git merge --squash ${BRANCH}"
    mkb = "!BRANCH=`git rev-parse --abbrev-ref HEAD`; git dev; git pull origin; git co -b bugfix/${BRANCH}; git merge --squash ${BRANCH}"
    rmb = "!f(){ git push -f $1 :`git rev-parse --abbrev-ref HEAD`; };f"

    p = !git push origin `git rev-parse --abbrev-ref HEAD`
    pf = !git push -f origin `git rev-parse --abbrev-ref HEAD`

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