Skip to content

Commit

Permalink
Add gfa function and gfap alias for git
Browse files Browse the repository at this point in the history
  • Loading branch information
adrw committed Mar 11, 2019
1 parent 64ea308 commit 941f11d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
1 change: 1 addition & 0 deletions ansible/roles/adrw-shell/files/.adrw-aliases
Expand Up @@ -43,6 +43,7 @@ alias gl="git log --oneline"
alias gg="git grep"
alias git_rm="git reset --hard HEAD~1" # delete most recent commit
alias git_undo="git reset HEAD~" # unstages most recent commit but keeps changes
alias gfap='gfa; git push -f'

# Docker
alias dc="docker-compose"
Expand Down
21 changes: 18 additions & 3 deletions ansible/roles/adrw-shell/files/.adrw-functions
Expand Up @@ -178,6 +178,21 @@ function gri {
esac
}

# merge current changes into previous commit
function gfa() {
if [ "$(git merge-base "$(git rev-parse --abbrev-ref HEAD)" master)" == "$(git rev-parse HEAD)" ]
then
echo "No commits from master found!"
else
if [ "$#" -eq 0 ]
then
git commit --amend -a --no-edit
else
git commit --amend --no-edit "$@"
fi
fi
}

# update etchosts. has bias towards maintaining the default (locked down) state
function etc {
ADRWL "[${package}::${0}]" "Register Logging Prefix"
Expand Down Expand Up @@ -397,13 +412,13 @@ function mv_user {

# Docker
function dka {
docker kill $(docker ps -q)
docker kill "$(docker ps -q)"
}
function drmc {
docker rm -f $(docker ps -a -q)
docker rm -f "$(docker ps -a -q)"
}
function drmi {
docker rmi -f $(docker images -q)
docker rmi -f "$(docker images -q)"
}

# zmv
Expand Down

0 comments on commit 941f11d

Please sign in to comment.