Shorties (7 Part Series)
I build an app and use git branches.
Branches sum up, I don't know which branches are already merged into master and I lose overview.
I need a command that checks if a branch is merged into master and if it is merged, it should get deleted locally.
git checkout master(or whatever branch you want to compare to)
git branch --merged | egrep -v "(^\*|master|dev)" | xargs git branch -d
git branch --merged: List all branches whose tips are reachable from the specified commit (HEAD if not specified).
egrep -v "(^\*|master|dev)": Search for all lines that do not start with
*(= the current branch), or don't have
xargs git branch -d: Execute the command to delete all found branches from step 2.
I’ve sent a message to my family and delegated my open source projects to my friends. With my last tweet sent, I turn off my laptop, phone, and tablet. My Digital Sabbath begins in 10 minutes: no digital devices for the next month.