Skip to content

Instantly share code, notes, and snippets.

View jenncoop's full-sized avatar

Jenn Cooper jenncoop

View GitHub Profile
@expede
expede / debase.zsh
Last active August 29, 2015 14:08
git debase
# Similar to a squashed rebase
# Merges branch A into B, and then resets the branch to A,
# producing an unstaged diff of B for your commit
# exampe usage: `debase master`
# (note the lack of `git` prefix)
function debase() {
if [[ -z $1 ]]; then
echo 'missing branch to debase from'
else
branch=${1}
@ricardobeat
ricardobeat / README.md
Last active April 14, 2020 18:19
git remaster

git-remaster updates both your current branch and master branch simultaneously, while preserving all commited, staged and unstaged changes.

Install

Add git-remaster to your path and make it executable:

curl https://gist.githubusercontent.com/ricardobeat/9600953/raw/git-remaster.sh > /usr/local/bin/git-remaster
chmod +x /usr/local/bin/git-remaster
@pixelhandler
pixelhandler / pre-push.sh
Last active April 8, 2024 01:04
Git pre-push hook to prevent force pushing master branch
#!/bin/sh
# Called by "git push" after it has checked the remote status,
# but before anything has been pushed.
#
# If this script exits with a non-zero status nothing will be pushed.
#
# Steps to install, from the root directory of your repo...
# 1. Copy the file into your repo at `.git/hooks/pre-push`
# 2. Set executable permissions, run `chmod +x .git/hooks/pre-push`