Skip to content

Instantly share code, notes, and snippets.

@hasantezcan
Last active March 3, 2021 01:04
Show Gist options
  • Save hasantezcan/b643651871a5b9023ee715a09532ac96 to your computer and use it in GitHub Desktop.
Save hasantezcan/b643651871a5b9023ee715a09532ac96 to your computer and use it in GitHub Desktop.
git repo alias - access repo link directly from command prompt
alias git-repo="git config --get remote.origin.url | sed -e 's/:/\//g'| sed -e 's/ssh\/\/\///g'| sed -e 's/git@/https:\/\//g'"
alias git-pr="git config --get remote.origin.url | sed -e 's/:/\//g'| sed -e 's/ssh\/\/\///g'| sed -e 's/git@/https:\/\//g' | sed 's/....$//' | sed -ne 's/$/\/pulls &/p'"
# https://stackoverflow.com/a/63907839/10694425
# https://stackoverflow.com/a/66395349/10694425
@hasantezcan
Copy link
Author

How to add alias

@hasantezcan
Copy link
Author

alias git-repo="git config --get remote.origin.url | sed -e 's/:/\//g'| sed -e 's/ssh\/\/\///g'| sed -e 's/git@/https:\/\//g'; xdg-open '$(git config --get remote.origin.url | sed -e 's/:/\//g' -e 's/ssh\/\/\///g' -e 's/git@/https:\/\//g')'"
alias git-pr="git config --get remote.origin.url | sed -e 's/:/\//g'| sed -e 's/ssh\/\/\///g'| sed -e 's/git@/https:\/\//g' | sed 's/....$//' | sed -ne 's/$/\/pulls &/p'; xdg-open '$(git config --get remote.origin.url | sed -e 's/:/\//g'| sed -e 's/ssh\/\/\///g'| sed -e 's/git@/https:\/\//g' | sed 's/....$//' | sed -ne 's/$/\/pulls &/p')'" 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment