Skip to content

Instantly share code, notes, and snippets.

@copperlight
Last active December 7, 2020 01:08
Show Gist options
  • Save copperlight/219cf5081e57b186b7e3fe5096037d61 to your computer and use it in GitHub Desktop.
Save copperlight/219cf5081e57b186b7e3fe5096037d61 to your computer and use it in GitHub Desktop.
description
[[snippets]]
description = "list remote branches"
command = "git branch -r"
output = ""
[[snippets]]
description = "list all local and remote branches"
command = "git branch -a"
output = ""
[[snippets]]
description = "list remote repositories"
command = "git remote -v"
output = ""
[[snippets]]
description = "add new remote upstream repository"
command = "git remote add up [email protected]:<ORIGINAL_OWNER>/<ORIGINAL_REPOSITORY>.git"
output = ""
[[snippets]]
description = "fetch upstream commits"
command = "git fetch up"
output = ""
[[snippets]]
description = "merge upstream/master changes into the current (master) branch"
command = "git merge master/up"
output = ""
[[snippets]]
description = "delete local branch"
command = "git branch -D <branch-name>"
output = ""
[[snippets]]
description = "delete remote branch"
command = "git push origin :<branch-name>"
output = ""
[[snippets]]
description = "create 100MB file containing all zeroes"
command = "head -c 100MB /dev/zero >image.iso"
output = ""
[[snippets]]
description = "send an image file to a disk device"
command = "cat image.iso >/dev/sdb"
output = ""
[[snippets]]
description = "send an image file to a disk device, with a progress meter"
command = "cat image.iso | pv >/dev/sdb"
output = ""
[[snippets]]
description = "change the message of the last commit"
command = "git commit --amend"
output = ""
[[snippets]]
description = "show all commits by a user over the past day"
command = "git log --author=\"[email protected]\" --since=1.days"
output = ""
[[snippets]]
description = "current milliseconds since epoch, for OSX"
command = "gdate +\"%s%3N\""
output = ""
[[snippets]]
description = "rewrite repository so that foodir is the root, discarding all other commits"
command = "git filter-branch --subdirectory-filter foodir -- --all"
output = ""
[[snippets]]
description = "change remote url"
command = "git remote set-url origin https://github.com/USERNAME/OTHERREPOSITORY.git"
output = ""
[[snippets]]
description = "read a file line-by-line, in fish"
command = "while read LINE; echo $LINE; end < filename"
output = ""
[[snippets]]
description = "remove object from s3 bucket, with a named profile"
command = "aws --profile $PROFILE s3 rm \"s3://$BUCKET/$KEY\""
output = ""
[[snippets]]
description = "delete item from dynamodb table"
command = "aws --profile $PROFILE --region $REGION dynamodb delete-item --table-name $TABLE_NAME --key '{\"Id\": {\"N\": \"456\"}}'"
output = ""
[[snippets]]
description = "install a local package, to replace one that is already installed"
command = "sudo dpkg -i -B package.deb"
output = ""
[[snippets]]
description = "invalidate gradle cache"
command = "gradlew build --refresh-dependencies"
output = ""
[[snippets]]
description = "trace dependency for a top level project"
command = "gradlew dependencyInsight --configuration <gradle config> --dependency <dep>"
output = ""
[[snippets]]
description = "trace dependency for one subproject in a multiproject build"
command = "gradlew :<subproject>:dependencyInsight --configuration <gradle config> --dependency <dep>"
output = ""
[[snippets]]
description = "list gradle projects"
command = "gradlew projects"
output = ""
[[snippets]]
description = "list first commit in a repo"
command = "git rev-list --max-parents=0 HEAD"
output = ""
[[snippets]]
description = "display key length, fingerprint and algorithm"
command = "ssh-keygen -lf id_rsa"
output = ""
[[snippets]]
description = "undo the last commit, so you can edit it and re-commit"
command = "git reset --soft HEAD^"
output = ""
[[snippets]]
description = "redo the last commit, starting with its log message (paired with the undo)"
command = "git commit -a -c ORIG_HEAD"
output = ""
[[snippets]]
description = "list iam roles and instance profiles you may retrieve credentials for"
command = "newt --app-type awscreds roles -A"
output = ""
[[snippets]]
description = "obtain credentials for an aws console user role and write them to ~/.aws/credentials"
command = "newt --app-type awscreds refresh -r <rolename> <optional profile name>"
output = ""
[[snippets]]
description = "obtain credentials for applications your team manages"
command = "newt --app-type awscreds refresh -r <AccountId>:role/<YourApplicationInstanceProfile> <optional profile name>"
output = ""
[[snippets]]
description = "print credentials to the screen, for environment variables"
command = "newt --app-type awscreds export -r <rolename>"
output = ""
[[snippets]]
description = "rebase the only two commits in a git repository into one commit"
command = "git reset --soft HEAD~ && git commit --amend"
output = ""
[[snippets]]
description = "clone pull request from stash, when it originates from a forked repo"
command = "git prstash origin <pr-number> <dest-branch>"
output = ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment