Skip to main content

Gists

Roman
Author
Roman
Photographer with MSci in Computer Science
Table of Contents

Commit Messages Style

# Description

Please include a summary of the changes and features. Please also include relevant motivation and context. List any dependencies that are required for this change.

# URL to relevant Jira ticket

Please include the link to the relevant Jira ticket here for ease of cross-referencing.

## Type of change

Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Technical Enhancements


# Checklist:

If any of these are not completed, please explain why in notes.

## **Definition of Done**
**Code and merges**

- [ ] Code review (informal/walk through (and/or produced with Pair programming)
- [ ] Code review completed by the appropriate people (1 thumbs up)
- [ ] Code to be commented where applicable 
- [ ] Documentation updated where required 
- [ ] Have considered non-functional requirements such as Security, Performance, Scalability and Fault Tolerance.

**Testing**

- [ ] All levels of acceptance test are passing (automated, integration, manual, accessibility etc.)
- [ ] Functional test passed
- [ ] Acceptance criteria met

**Deployment**

- [ ] Builds are green

**Other Checks**
- [ ] I have performed a self-review of my own code
- [ ] I have checked for spelling errors
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] My changes don't break anything unexpected
- [ ] Up to date with master branch
 
# Notes:

Add any extra information that is important for the rest of the team/reviewers to know here.

Git Alias

# Logging Aliases
git config --global alias.ll 'log --oneline'
git config --global alias.plog 'log --graph --pretty="format:%C(red)%d%C(reset) %C(yellow)%h%C(reset) %ar %C(green)%aN%C(reset) %s"'
git config --global alias.llog 'log --color --graph --pretty=format:"%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset" --abbrev-commit'
git config --global alias.tlog 'log --stat --since="1 Day Ago" --graph --pretty=oneline --abbrev-commit --date=relative'
git config --global alias.last 'log -1 HEAD --stat'
git config --global alias.mylog '!git log --author="$(git config user.name)" --graph --pretty="format:%C(red)%d%C(reset) %C(yellow)%h%C(reset) %ar %C(green)%aN%C(reset) %s"'

# User statistics and info
git config --global alias.gl 'config --global -l' # lists user configs
git config --global alias.rank 'shortlog -sn --no-merges'
git config --global alias.aliases "config --get-regex 'alias*'" # List all aliases

# Branch Info
git config --global alias.lb 'branch --format="%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(contents:subject) %(color:green)(%(committerdate:relative)) [%(authorname)]" --sort=-committerdate' # List all branches

# Shortening aliases
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.d 'diff'

# Feature improving aliases
git config --global alias.cob 'checkout -b' # Create new branch and switch to it
git config --global alias.del 'branch -D' # delete branch git del feat/temp
  # Finds default branch name  
git config --global alias.default '!git symbolic-ref refs/remotes/origin/HEAD | sed "s@^refs/remotes/origin/@@"'
  # Pull changes for a branch and rebase them into our working directory
git config --global alias.pullin '!f() { DEFAULT=$(git default); git fetch origin && git rebase origin/${1-$DEFAULT}; };f'
  # Take all uncommitted and un-staged changes currently in the working directory and add them to the previous commit
git config --global alias.caa 'commit -a --amend -C HEAD'



# Mistake correction aliases
git config --global alias.undo 'reset HEAD~1 --mixed' # Rollback changes previous commit moved into staging area
git config --global alias.rh '!git reset --hard' # clean all staged changes
  # hard reset to branch origin
git config --global alias.oops '!f() { DEFAULT=$(git rev-parse --abbrev-ref HEAD); git reset --hard origin/${1-$DEFAULT}; };f'

# Funny/stupid
git config --global alias.paid push

# Branch naming conventional commites
  # git feat name => feat/name
git config --global alias.feat '!f() { NAME=${1}; git checkout -b feat/$NAME; };f'
  # git feat name 5110 => feat/h-5110-name
  # git config --global alias.feat '!f() { WORKNUM=${2-'000'}; NAME=${1}; git checkout -b feat/gf-$WORKNUM-$NAME; };f'
  # git fix name => fix/name
git config --global alias.fix '!f() { NAME=${1}; git checkout -b fix/$NAME; };f'
  # git docs name => docs/name
git config --global alias.docs '!f() { NAME=${1}; git checkout -b docs/$NAME; };f'
  # git refactor name => refactor/name
git config --global alias.refactor '!f() { NAME=${1}; git checkout -b refactor/$NAME; };f'
  # git test name => test/name
git config --global alias.test '!f() { NAME=${1}; git checkout -b test/$NAME; };f'
  # git chore name => chore/name
git config --global alias.chore '!f() { NAME=${1}; git checkout -b chore/$NAME; };f'
  # git config name => config/name
git config --global alias.config '!f() { NAME=${1}; git checkout -b config/$NAME; };f'


# Other
git config --global alias.rv 'remote -v' # lists configured remote repos
git config --global alias.dv 'difftool -t vimdiff -y'
git config --global alias.se '!git rev-list --all | xargs git grep -F'