Skip to content

Instantly share code, notes, and snippets.

@bzamecnik
Created December 19, 2018 13:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bzamecnik/81566eeabbe4fb116ff7d1ced926d062 to your computer and use it in GitHub Desktop.
Save bzamecnik/81566eeabbe4fb116ff7d1ced926d062 to your computer and use it in GitHub Desktop.
SSH refresh in tmux & git force pull
# refresh SSH socket after reconnect to tmux (useful with ssh agent forwarding)
alias ssh_refresh='export $(tmux show-environment | grep "^SSH_AUTH_SOCK")'
# list current git branch
alias git_current_branch='git branch | grep \* | cut -d " " -f2'
# force pull (after rebase in remote)
alias git_pull_force='ssh_refresh && git fetch && git reset --hard origin/$(git_current_branch)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment