-
-
Save jelc53/9e08290625a2264b292ede62343af802 to your computer and use it in GitHub Desktop.
collection of simple git functions
This file contains hidden or 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
#!/bin/bash | |
# source this file from your ~/.bashrc, i.e. `source git_funcs.sh` | |
# run this before making changes, otherwise you'll need to deal with merge conflicts | |
# usage: gitu | |
gitu () { git pull --rebase; } | |
# add it all, push it all, fuck the police | |
# usage: gitx | |
gitx () { | |
git add --all | |
git commit -m ${1:-yolo} | |
git push | |
} | |
# switch to a git branch | |
# usage: gitb feature_a | |
gitb () { git checkout $1; } | |
# rename a file | |
# usage: gitrn my_file_a.tsv my_file_b.tsv | |
gitrn () { git mv $1 $2; } | |
# get the git state of your current project | |
# usage: gits | |
gits () { git status; } | |
# remove a file | |
# usage: gitrm my_file | |
gitrm () { git rm -f $1; } | |
# create a git branch | |
# usage: gitcb | |
gitcb () { git checkout -b $1 && git push --set-upstream origin $1; } | |
# delete branch | |
# usage: gitdb branch_name | |
gitdb () { git branch -d $1 && git push origin --delete $1; } | |
# merge branch into current branch | |
# usage: gitm other_branch_name | |
gitm () { git merge --squash $1; } | |
# git history (as patches) | |
# usage: gith path/to/some_file | |
gith () { git log -p -- $1; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment