File tree Expand file tree Collapse file tree 5 files changed +53
-1
lines changed
Expand file tree Collapse file tree 5 files changed +53
-1
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ fundle plugin joseluisq/gitnow
6464| [ assume] ( #assume ) | | Ignores changes in certain files temporarily. |
6565| [ logs] ( #logs ) | Alt + L | Shows logs in a fancy way. |
6666| __ Gitflow__ | | |
67+ | [ branch] ( #branch ) (1) | | Creates a new branch from current branch. |
6768| [ feature] ( #feature ) (1) | Alt + F | Creates a new _ feature_ ([ Gitflow] ( https://github.com/nvie/gitflow ) ) branch from current branch. |
6869| [ hotfix] ( #hotfix ) (1) | Alt + H | Creates a new _ hotfix_ ([ Gitflow] ( https://github.com/nvie/gitflow ) ) branch from current branch. |
6970| [ bugfix] ( #bugfix ) (1) | | Creates a new _ bugfix_ ([ Gitflow] ( https://github.com/nvie/gitflow ) ) branch from current branch. |
@@ -390,6 +391,19 @@ assume Cargo.toml README.md
390391assume -n Cargo.toml README.md
391392```
392393
394+ ### branch
395+
396+ Creates a new branch ([ Gitflow] ( https://github.com/nvie/gitflow ) ) from current branch.
397+
398+ __ Note:__ Your new branch will always be lowercase without special characters or whitespaces (underscores instead).
399+
400+ ``` sh
401+ branch CODE-1234
402+ # > code-1234
403+ branch " This is my New Branch"
404+ # > this_is_my_new_branch
405+ ```
406+
393407### feature
394408
395409Creates a new feature ([ Gitflow] ( https://github.com/nvie/gitflow ) ) branch from current branch.
Original file line number Diff line number Diff line change 1+ # GitNow — Speed up your Git workflow. 🐠
2+ # https://github.com/joseluisq/gitnow
3+
4+ # Branch command
5+
6+ __gitnow_load_git_functions
7+
8+ complete -f -k -x -c branch -a ' (__fish_git_branches)'
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ set -g gitnow_version 2.13.0
55
66# Default global variables
77set -q GITNOW_CONFIG_FILE; or set -g GITNOW_CONFIG_FILE ~/.gitnow
8- set -g gitnow_commands ' all' ' assume' ' bitbucket' ' bugfix' ' commit' ' commit-all' ' feature' ' github' ' gitnow' ' hotfix' ' logs' ' merge' ' move' ' pull' ' push' ' release' ' show' ' stage' ' state' ' tag' ' unstage' ' untracked' ' upstream'
8+ set -g gitnow_commands ' all' ' assume' ' bitbucket' ' bugfix' ' commit' ' commit-all' ' branch ' ' feature' ' github' ' gitnow' ' hotfix' ' logs' ' merge' ' move' ' pull' ' push' ' release' ' show' ' stage' ' state' ' tag' ' unstage' ' untracked' ' upstream'
99
1010if set -q __fish_config_dir
1111 set -g fish_config " $_ _fish_config_dir"
@@ -239,6 +239,15 @@ function upstream -d "Gitnow: Commit all changes and push them to remote server"
239239 push
240240end
241241
242+ function branch -d " GitNow: Creates a new Gitflow branch from current branch" -a xbranch
243+ if not __gitnow_is_git_repository
244+ __gitnow_msg_not_valid_repository " branch"
245+ return
246+ end
247+
248+ __gitnow_check_create_branch " $xbranch "
249+ end
250+
242251function feature -d " GitNow: Creates a new Gitflow feature branch from current branch" -a xbranch
243252 if not __gitnow_is_git_repository
244253 __gitnow_msg_not_valid_repository " feature"
Original file line number Diff line number Diff line change 1+ # GitNow — Speed up your Git workflow. 🐠
2+ # https://github.com/joseluisq/gitnow
3+
4+ function __gitnow_check_create_branch -a xbranch
5+ set -l xfound (__gitnow_check_if_branch_exist $xbranch )
6+
7+ if test -n " $xbranch "
8+ if test $xfound -eq 1
9+ echo " Branch `$xbranch ` already exists. Nothing to do."
10+ else
11+ command git stash
12+ __gitnow_new_branch_switch " $xbranch "
13+ command git stash pop
14+ end
15+ else
16+ echo " Branch name is required."
17+ end
18+ end
Original file line number Diff line number Diff line change @@ -59,6 +59,9 @@ function __gitnow_manual -d "Gitnow: Manual page like"
5959 echo " " (set_color --bold )" assume" (set_color normal)
6060 echo " Ignore changes in certain files temporarily."
6161 echo
62+ echo " " (set_color --bold )" branch" (set_color normal)
63+ echo " Create a new branch from the current branch."
64+ echo
6265 echo " " (set_color --bold )" feature" (set_color normal)
6366 echo " Create a new Gitflow feature branch from the current branch."
6467 echo
You can’t perform that action at this time.
0 commit comments