Git Cookbook

Bunch of git procedures that I never seem to keep in my head.

Removing submodules

My biggest pain while using Git. I love submodules, but hate managing them.

This seems to a concise list of steps for the procedure

https://davidwalsh.name/git-remove-submodule

Remove git branches by date

In some repos, old branches pile up by date. While there is not much physical cost to keeping this refs around, it is a painful one to wade through searching for that one branch with your changes.

Using this wonderful cookbook entry, here is how to delete branches which are, for example, from 2018:

git for-each-ref --sort=authordate --format '%(authordate:iso) %(refname:short)' |grep 2018| cut -d " " -f 4-| sed 's/origin\///'| xargs -n 1 git push origin --delete

vcs 
git 
comments powered by Disqus