Git branches automate with source code

I am automating the git brnach with my project using shell script. Code Description

  • I am going to the source directory
  • I am doing remote update
  • I am asking user to enter the branch, if user entered wrong branch name
  • If the branch doest not exist catch the error and show the user otherwise git checkout and pull the code from the branch


            cd application/hexgen/src/
            git remote update
            echo "please check all the available branch in git"
            git branch
            echo "Please enter the branch name: "
            read branch_name
            echo "You entered: $branch_name"
            branch=$(git branch)
            select SEL in "${files[@]}"
                if  [[ "$SEL" ] !== '(no branch)']
                    echo "Choose one of the available branch."
                    git checkout $branch_name
                    git pull origin $branch_name
        git checkout $branch_name    
        git branch    
        git pull origin $branch_name*

And i am getting this error.

Please enter the branch name:
You entered: 1.5
ram: line 21: conditional binary operator expected
ram: line 21: syntax error near `]'
ram: line 21: `    if  [[ "$SEL" ] !== '(no branch)']'

Can someone help this..

Source: bash

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.