Snippets Collections
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"
star

Sun Feb 27 2022 04:50:49 GMT+0000 (UTC) https://www.lazy-electron.com/2021/07/29/git-aliases.html

#git #tool #work

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension