Skip to content

Instantly share code, notes, and snippets.

@morganestes
Last active June 17, 2016 18:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save morganestes/76fa910047ecc00e0557 to your computer and use it in GitHub Desktop.
Save morganestes/76fa910047ecc00e0557 to your computer and use it in GitHub Desktop.
Custom Git commands for bash

Git commands that I use enough that I decided to write them down.

#!/usr/bin/env bash
rename_branch() {
old_branch=$(git rev-parse --abbrev-ref HEAD)
new_branch=$1
git branch -m "${1}"
git push origin --delete "${old_branch}"
git push --set-upstream origin "${new_branch}"
}
rename_branch
#!/bin/bash
git ls-files -ci --exclude-standard -z | xargs -0 git rm --cached
#!/bin/bash
git rev-parse --abbrev-ref HEAD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment