I have a buildspec in CodeBuild which downloads 2 branches(develop and refactored_branch) from different repos with the sources referenced in Source in CodeBuild. I have a script that makes some changes by copying some files from develop branch into refactored_branch. When I am done with copying of the files I want to copy all those changes from refactored_branch to another already existing branch (branch_to_be_pushed) which is in the same repo as refactored_branch and push branch_to_be_pushed to github? I tried git checkout branch_to_be_pushed and then git pull refactored branch and even git merge refactored_branch but no luck.The buildspec looks like this:
pre_build:
    commands:
    - cd $CODEBUILD_SRC_DIR
    - pwd
    - git checkout develop
    - cd $CODEBUILD_SRC_DIR_Source2
    - pwd
    - git checkout refactored_branch
    - git config --global user.email $User    
    commands:
       - ./bin/deploy.py -src1=$CODEBUILD_SRC_DIR -src2=$CODEBUILD_SRC_DIR_Source2
  post_build:
    commands:
      - cd $CODEBUILD_SRC_DIR_Source2
      - pwd
      - ls -la
      - git status
      - git branch
      - git checkout branch_to_be_pushed
      - git status
      - git branch
      - git add .
      - git commit -m "push changes"
      - pwd
      - ls -la
      - git push https://$User:$Pass@github.com/xxxxxx/xxxxx-xxxxxx-xxxx.git
 
    