Git : Add gw to open remove web url.

This commit is contained in:
Dmitry Voronin 2024-03-28 04:12:18 +03:00
parent ed912e1694
commit cb333b010f

View file

@ -178,6 +178,16 @@ function gv() {
git rev-list HEAD --count git rev-list HEAD --count
} }
# Open the remote web url in default browser.
# Usage: gw [REMOTE]
function gw() {
local remote="${1}"
[[ "${remote}" = "" ]] && remote="$(git remote | head -n1)"
local url="$(git remote get-url ${remote})"
open "${url}"
}
# Show current branch. # Show current branch.
function _git_current_branch() { function _git_current_branch() {
git branch --show-current 2> /dev/null git branch --show-current 2> /dev/null
@ -211,7 +221,7 @@ function _git_is_dotfiles() {
done done
} }
# autocomplete. # Autocomplete.
_completion_loader git &> /dev/null _completion_loader git &> /dev/null
__git_complete gps _git_push &> /dev/null __git_complete gps _git_push &> /dev/null
__git_complete gpsf _git_push &> /dev/null __git_complete gpsf _git_push &> /dev/null
@ -230,6 +240,7 @@ __git_complete gf _git_fetch &> /dev/null
__git_complete gt _git_tag &> /dev/null __git_complete gt _git_tag &> /dev/null
__git_complete gp _git_apply &> /dev/null __git_complete gp _git_apply &> /dev/null
__git_complete ga _git_add &> /dev/null __git_complete ga _git_add &> /dev/null
__git_complete gw _git_pull &> /dev/null
# Autocomplete with my git emails. # Autocomplete with my git emails.
function _gu() { function _gu() {