mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-08-07 06:08:39 +02:00
style(git): align verb tense in docs and fine-tune function order
This commit is contained in:
parent
facf5b9051
commit
3b7ac37b58
2 changed files with 12 additions and 10 deletions
|
|
@ -253,7 +253,7 @@ receive further support.
|
||||||
| `git_current_user_email` | Returns the `user.email` config value (Lives in `lib/git.zsh`) |
|
| `git_current_user_email` | Returns the `user.email` config value (Lives in `lib/git.zsh`) |
|
||||||
| `git_current_user_name` | Returns the `user.name` config value (Lives in `lib/git.zsh`) |
|
| `git_current_user_name` | Returns the `user.name` config value (Lives in `lib/git.zsh`) |
|
||||||
| `git_develop_branch` | Returns the name of the “development” branch: `dev`, `devel`, `development` if they exist, `develop` otherwise |
|
| `git_develop_branch` | Returns the name of the “development” branch: `dev`, `devel`, `development` if they exist, `develop` otherwise |
|
||||||
| `git_main_branch` | Returns the name of the main branch: `main` if it exists, `master` otherwise
|
| `git_main_branch` | Returns the name of the main branch: `main` if it exists, `master` otherwise |
|
||||||
| `gbcopy` | Copy current branch name to clipboard |
|
| `gbcopy` | Copy current branch name to clipboard |
|
||||||
| `grename <old> <new>` | Renames branch `<old>` to `<new>`, including on the origin remote |
|
| `grename <old> <new>` | Renames branch `<old>` to `<new>`, including on the origin remote |
|
||||||
| `gbda` | Deletes all merged branches |
|
| `gbda` | Deletes all merged branches |
|
||||||
|
|
|
||||||
|
|
@ -22,16 +22,7 @@ function git_develop_branch() {
|
||||||
echo develop
|
echo develop
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
function gbcopy() {
|
|
||||||
# Check if we are in a Git repository
|
|
||||||
command git rev-parse --is-inside-work-tree &>/dev/null || return
|
|
||||||
|
|
||||||
local branch
|
|
||||||
branch="$(git_current_branch)" || return
|
|
||||||
[[ -n "$branch" ]] || return 1
|
|
||||||
|
|
||||||
print -rn -- "$branch" | clipcopy
|
|
||||||
}
|
|
||||||
|
|
||||||
# Get the default branch name from common branch names or fallback to remote HEAD
|
# Get the default branch name from common branch names or fallback to remote HEAD
|
||||||
function git_main_branch() {
|
function git_main_branch() {
|
||||||
|
|
@ -59,6 +50,17 @@ function git_main_branch() {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function gbcopy() {
|
||||||
|
# Check if we are in a Git repository
|
||||||
|
command git rev-parse --is-inside-work-tree &>/dev/null || return
|
||||||
|
|
||||||
|
local branch
|
||||||
|
branch="$(git_current_branch)" || return
|
||||||
|
[[ -n "$branch" ]] || return 1
|
||||||
|
|
||||||
|
print -rn -- "$branch" | clipcopy
|
||||||
|
}
|
||||||
|
|
||||||
function grename() {
|
function grename() {
|
||||||
if [[ -z "$1" || -z "$2" ]]; then
|
if [[ -z "$1" || -z "$2" ]]; then
|
||||||
echo "Usage: $0 old_branch new_branch"
|
echo "Usage: $0 old_branch new_branch"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue