Skip to content

Commit e2f1590

Browse files
author
Bhavi Dhingra
committed
feat(new-command): gmerge merges a local repo to the current repo
1 parent 8721752 commit e2f1590

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

cmd/gmerge

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env bash
2+
3+
#shellcheck disable=SC1091 # Not following: ./__assertgitrepo was not specified as input
4+
#shellcheck disable=SC2086 # Double quote to prevent globbing and word splitting
5+
#shellcheck disable=SC2155 # Declare and assign separately to avoid masking return values
6+
7+
# ensure the command is run in a git repo
8+
source "${__CUSTOM_GIT_UTIL}"/__assertgitrepo
9+
source "${__CUSTOM_GIT_UTIL}"/__select_local_branch
10+
source "${__CUSTOM_CONSOLE_UTIL}"/__exit_if_empty_str
11+
source "${__CUSTOM_CONSOLE_UTIL}"/__common
12+
13+
main () {
14+
15+
__assertgitrepo
16+
17+
clear
18+
local branchName="$(__select_local_branch "gmerge" "select local branch to merge" "exit")"
19+
__exit_if_empty_str "${branchName}" ${SUCCESS}
20+
21+
git merge "${branchName}"
22+
git status
23+
}
24+
25+
if [[ $# -gt 0 ]]; then
26+
# branch name is provided in command line arguments
27+
clear
28+
git merge "$*"
29+
git status
30+
exit ${SUCCESS}
31+
fi
32+
33+
main

0 commit comments

Comments
 (0)