File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,16 @@ function analyzeWorkingDir (){
1919function pushActual() {
2020 executeCommand " git fetch --all"
2121 importantLog " Checking your head state"
22+
23+ # Check if the current branch has an upstream (remote)
24+ if [ -z " $( git rev-parse --abbrev-ref --symbolic-full-name ${current_branch} @{upstream} 2> /dev/null) " ]; then
25+ echo " The current branch '" $actual " ' doesn't have an upstream branch."
26+ echo
27+ echo -n " Do you want to create and attach remot branch (y/n)?" && wait_for_keypress && echo
28+ [ " $REPLY " != " y" ] && waitonexit && return
29+ setUpstream
30+ fi
31+
2232 if git status | grep -q " HEAD detached" ; then
2333 redLog " ... you seem to be on a detached head state ... can't push ..."
2434 else
@@ -65,12 +75,6 @@ function mergeChanges () {
6575 # Get the name of the current branch
6676 current_branch=$( git rev-parse --abbrev-ref HEAD)
6777
68- # Check if the current branch has an upstream (remote)
69- if [ -z " $( git rev-parse --abbrev-ref --symbolic-full-name ${current_branch} @{upstream} 2> /dev/null) " ]; then
70- echo " The current branch '$current_branch ' doesn't have an upstream branch."
71- exit 1
72- fi
73-
7478 # Get the number of commits ahead of the remote branch
7579 ahead_count=$( git rev-list --count ${current_branch} @{upstream}..${current_branch} )
7680 behind_count=$( git rev-list --count ${current_branch} ..${current_branch} @{upstream})
You can’t perform that action at this time.
0 commit comments