Skip to content

Instantly share code, notes, and snippets.

View jannismain's full-sized avatar
📖

Jannis Mainczyk jannismain

📖
  • codecentric
  • Munich, Germany
View GitHub Profile
@jannismain
jannismain / git-cleanup-repo
Last active July 20, 2022 10:56 — forked from robmiller/git-cleanup-repo
A script for cleaning up Git repositories; it deletes branches that are fully merged into your default branch, prunes obsolete remote tracking branches, and as an added bonus will replicate these changes on the remote.
#!/bin/bash
# git-cleanup-repo
#
# Adapted by Jannis Mainczyk <[email protected]>
# - support different default branches
# - add output per step
# Adapted by Rob Miller <[email protected]>
# Original by Yorick Sijsling
default_branch=${1:-master}
read -p "Continue with default branch '${default_branch}' (y/N)? "
@jannismain
jannismain / .gitconfig
Created April 1, 2022 14:13 — forked from robmiller/.gitconfig
Some useful Git aliases that I use every day
#
# Working with branches
#
# Get the current branch name (not so useful in itself, but used in
# other aliases)
branch-name = "!git rev-parse --abbrev-ref HEAD"
# Push the current branch to the remote "origin", and set it to track
# the upstream branch
publish = "!git push -u origin $(git branch-name)"
@jannismain
jannismain / import_from_gist.py
Last active May 14, 2020 20:26 — forked from koji-kojiro/import_from_gist.py
[Python] import from Gist
#!/usr/bin/env python3
def load_gist(gist_id):
"""translate Gist ID to URL"""
from json import load
from urllib.request import urlopen
gist_api = urlopen("https://api.github.com/gists/" + gist_id)