Skip to content

Instantly share code, notes, and snippets.

View vimkin's full-sized avatar

Vadim Kalinin vimkin

View GitHub Profile
@vimkin
vimkin / Cleanup up local git branches.md
Created May 14, 2025 09:02
A guide for cleaning up stale local Git branches. This gist explains how to remove branches whose upstream remotes have been deleted, covering differences between git branch --merged and git branch -v based on the [gone] marker.

In case you are using a typical Git workflow, where merged branches are removed from the remote repository (e.g., GitHub, GitLab), you may find yourself with a lot of stale local branches that have no upstreams.

A common suggestion to clean up these local branches is to run:

git fetch --prune
git branch --merged | egrep -v 'master|dev|main|staging' | xargs git branch -d

This command works only if you use a merge (not rebase) strategy and it only deletes branches that have been merged into your current branch (for example, you are in main now).

@vimkin
vimkin / gist:517f356990c9fbe785b0c73e9bedda50
Created October 13, 2021 10:36 — forked from stuart11n/gist:9628955
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
/* http://meyerweb.com/eric/tools/css/reset/
v2.0-modified | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,