git alias

PHOTO EMBED

Sun Feb 27 2022 04:50:49 GMT+0000 (Coordinated Universal Time)

Saved by @tfrain #git #tool

git config --global alias.glg 'log --oneline --decorate --all --graph'
git config --global alias.amend 'commit --amend --reuse-message=HEAD'
git add -p
git commit 
git add -p
git amend 

git config --global alias.changelog "log origin..HEAD --format='* %s%n%w(,4,4)%+b'"
git config --global alias.workon '!f(){ git fetch && git checkout -b "$1" $(git symbolic-ref refs/remotes/origin/HEAD | sed "s@^refs/remotes/@@"); };f'
git config --global alias.cleanup-merged "!f(){ git fetch && git branch --merged | grep -v '* ' | xargs git branch --delete; };f"


- name: setup git aliases
  community.general.git_config:
    scope: global
    state: present
    name: "alias.{{ item.alias }}"
    value: "{{ item.value }}"
  with_items:
    - alias: changelog
      value: log origin..HEAD --format='* %s%n%w(,4,4)%+b'
    - alias: glg
      value: log --oneline --decorate --all --graph
    - alias: amend
      value: commit --amend --reuse-message=HEAD
    - alias: workon
      value: '!f(){ git fetch && git checkout -b "$1" $(git symbolic-ref refs/remotes/origin/HEAD | sed "s@^refs/remotes/@@"); };f'
    - alias: refresh
      value: '!f(){ git fetch && git stash && git rebase $(git symbolic-ref refs/remotes/origin/HEAD | sed "s@^refs/remotes/@@") && git stash pop; };f'
    - alias: cleanup-merged
      value: "!f(){ git fetch && git branch --merged | grep -v '* ' | xargs git branch --delete; };f"
content_copyCOPY

https://www.lazy-electron.com/2021/07/29/git-aliases.html