Created
October 8, 2013 12:55
-
-
Save rpowis/6884238 to your computer and use it in GitHub Desktop.
Git tricks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Apply a patch from another (unrelated) local repository | |
$ git --git-dir=../some_other_repo/.git format-patch -k -1 --stdout <commit SHA> | git am -3 -k | |
# Checout an empty branch to do something radically different (i.e. gh-pages) | |
$ git checkout --orphan <new_empty_branch> | |
# Find the root of the project | |
$ git rev-parse --show-toplevel | |
# Change to the root of the project | |
$ cd $(git rev-parse --show-toplevel) | |
# Delete a remote branch | |
$ git push origin --delete <branchName> | |
# Show all the content in your stashes | |
$ for stash in $(git stash list | awk '{print $1}' | sed -e 's/://'); do | |
> (echo ----- $stash ----- && git stash show -p $stash); | |
> done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment