Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
oh-my-zsh
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
github
oh-my-zsh
Commits
e8609b85
Unverified
Commit
e8609b85
authored
Feb 18, 2020
by
Ujwal Dhakal
Committed by
GitHub
Feb 18, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
git: add `grename` to rename a local branch and in the origin remote (#8622)
Co-authored-by:
Marc Cornellà
<
marc.cornella@live.com
>
parent
d49397a0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
14 deletions
+29
-14
README.md
plugins/git/README.md
+15
-14
git.plugin.zsh
plugins/git/git.plugin.zsh
+14
-0
No files found.
plugins/git/README.md
View file @
e8609b85
...
@@ -11,7 +11,7 @@ plugins=(... git)
...
@@ -11,7 +11,7 @@ plugins=(... git)
## Aliases
## Aliases
| Alias | Command |
| Alias | Command |
|:---------------------|:------------------------------------------------------------------------------------------------------------------------------|
|:---------------------|:------------------------------------------------------------------------------------------------------------------------------
---
|
| g | git |
| g | git |
| ga | git add |
| ga | git add |
| gaa | git add --all |
| gaa | git add --all |
...
@@ -177,25 +177,26 @@ plugins=(... git)
...
@@ -177,25 +177,26 @@ plugins=(... git)
These are aliases that have been removed, renamed, or otherwise modified in a way that may, or may not, receive further support.
These are aliases that have been removed, renamed, or otherwise modified in a way that may, or may not, receive further support.
| Alias | Command | Modification |
| Alias | Command | Modification |
| :----- | :-----------------------------------------------------
-----------------------------| ----------------------------------------------
----------------------------------------------------- |
| :----- | :-----------------------------------------------------
| :
----------------------------------------------------- |
| gap |
git add --patch | new alias
`gapa`
|
| gap |
`git add --patch`
| new alias
`gapa`
|
| gcl |
git config --list | new alias
`gcf`
|
| gcl |
`git config --list`
| new alias
`gcf`
|
| gdc |
git diff --cached | new alias
`gdca`
|
| gdc |
`git diff --cached`
| new alias
`gdca`
|
| gdt |
git difftool | no replacement
|
| gdt |
`git difftool`
| no replacement
|
| ggpull |
git pull origin $(current_branch) | new alias
`ggl`
(
`ggpull`
still exists for now though)
|
| ggpull |
`git pull origin $(current_branch)`
| new alias
`ggl`
(
`ggpull`
still exists for now though)
|
| ggpur |
git pull --rebase origin $(current_branch) | new alias
`ggu`
(
`ggpur`
still exists for now though)
|
| ggpur |
`git pull --rebase origin $(current_branch)`
| new alias
`ggu`
(
`ggpur`
still exists for now though)
|
| ggpush |
git push origin $(current_branch) | new alias
`ggp`
(
`ggpush`
still exists for now though)
|
| ggpush |
`git push origin $(current_branch)`
| new alias
`ggp`
(
`ggpush`
still exists for now though)
|
| gk |
gitk --all --branches | now aliased to
`gitk --all --branches`
|
| gk |
`gitk --all --branches`
| now aliased to
`gitk --all --branches`
|
| glg |
git log --stat --max-count = 10 | now aliased to
`git log --stat --color`
|
| glg |
`git log --stat --max-count = 10`
| now aliased to
`git log --stat --color`
|
| glgg |
git log --graph --max-count = 10 | now aliased to
`git log --graph --color`
|
| glgg |
`git log --graph --max-count = 10`
| now aliased to
`git log --graph --color`
|
| gwc |
git whatchanged -p --abbrev-commit --pretty = medium | new alias
`gwch`
|
| gwc |
`git whatchanged -p --abbrev-commit --pretty = medium`
| new alias
`gwch`
|
## Functions
## Functions
### Current
### Current
| Command | Description |
| Command | Description |
|:-----------------------|:----------------------------------------|
|:-----------------------|:---------------------------------------------------------|
|
`grename <old> <new>`
| Rename
`old`
branch to
`new`
, including in origin remote |
| current_branch | Return the name of the current branch |
| current_branch | Return the name of the current branch |
| git_current_user_name | Returns the
`user.name`
config value |
| git_current_user_name | Returns the
`user.name`
config value |
| git_current_user_email | Returns the
`user.email`
config value |
| git_current_user_email | Returns the
`user.email`
config value |
...
...
plugins/git/git.plugin.zsh
View file @
e8609b85
...
@@ -256,3 +256,17 @@ alias glum='git pull upstream master'
...
@@ -256,3 +256,17 @@ alias glum='git pull upstream master'
alias
gwch
=
'git whatchanged -p --abbrev-commit --pretty=medium'
alias
gwch
=
'git whatchanged -p --abbrev-commit --pretty=medium'
alias
gwip
=
'git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "--wip-- [skip ci]"'
alias
gwip
=
'git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "--wip-- [skip ci]"'
function
grename
()
{
if
[[
-z
"
$1
"
||
-z
"
$2
"
]]
;
then
echo
"Usage:
$0
old_branch new_branch"
return
1
fi
# Rename branch locally
git branch
-m
"
$1
"
"
$2
"
# Rename branch in origin remote
if
git push origin :
"
$1
"
;
then
git push
--set-upstream
origin
"
$2
"
fi
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment