Skip to content

Instantly share code, notes, and snippets.

View wowods's full-sized avatar

Wowo Diergo Suciawo wowods

View GitHub Profile
@wowods
wowods / README.md
Last active February 3, 2021 06:22
Script to removing old brances from local git repository

This script is based on explanation from https://gist.github.com/wowods/020197fa2d3ac0e411241479d8950b43.
Since remembering those commands is quite cumbersome, especially for a command that not used daily, so I make this script to make my life a little bit easier.

To use it, save the script below on your computer and run it on your git folder with argument -d to start deleting all the old brances.
If you want to check which branch that will be deleted, you could use argument -l.

Cleaning old branches on local repository

Ever want to clean up your local branched but it seems too tedious?
Ever been overwhelmed by too many branches on you local repo that already been merged?
Fear not my friend, I will share you a solution!

Simply checkout to your main branch (usually git checkout main),
and run this command

git fetch -p && git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -D
@wowods
wowods / labeled_statement.md
Last active October 21, 2020 09:38
Explanation about Labeled Statement on Swift

Do you ever work with nested statement and confuse how the break or continue statement works?

Take a look at this example code.

let data = [
  [1, 3, 5, 7, 9], // odd-number only
  [0, 2, 4, 6, 8], // even-number only
  [2, 3, 5, 7] // prime number
]
for values in data {