Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# The purpose of this script is to use a "local" git-directory alongside
# a "main" git working directory, and keep the two in sync. The "local" directory
# is used for storing local files that are associated with the "main" files but cannot
# be stored in the "main" directory (for example, local editor config files).
#
# Synopsis:
#
@mnieber
mnieber / git-pick
Created March 9, 2020 08:08
Picks a commit and puts it on a new branch
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Usage: git pick sha branch-name --base[=origin/master]
#
# Picks a commit and puts it on a new branch that is based off "base".
# The following actions are taken:
#
# - check if branch-name does not already exist (abort if it does)
# - resolve "sha" to an absolute hash
@mnieber
mnieber / git-split
Last active February 27, 2018 15:25
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Usage: git split [-ri] <sha>
#
# Creates a tag (the split-point) at the sha where your branch begins.
# Allows you to interactively rebase onto this tag.
# Allows you to rebase your branch onto some other sha,
# moving the split-point along.
#
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Usage: git fixdown [-vfd]
#
# Finds all commits that are corrected by the staged changes. If there is only one
# such commit, makes a fixup commit targetting that commit.
#
# Note: place this script on the path, so git can find it,
# and make it executable (chmod +x git-fixdown).