Created
September 26, 2019 08:14
-
-
Save wulucxy/992d4cfee1e01f7687606941f02abc3d to your computer and use it in GitHub Desktop.
shell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
list=$1 | |
if [ -z $1 ]; then | |
list=('contract-node' 'contract-node-render' 'decision-fe' 'goblin-web' 'little-boy-node' 'loan-adanos' 'loan-apollo' 'loan-panama' 'mall-node' 'wups-node') | |
fi | |
for project in ${list[@]}; do | |
echo fetch $project | |
cd $project-pbkd | |
master2=$(git branch | grep master2) | |
if [ -z $master2 ]; then | |
git remote add origin2 [email protected]:client/$project.git | |
git fetch origin2 | |
git checkout -b master2 origin2/master | |
else | |
git checkout master2 | |
git pull origin2 master | |
fi | |
git checkout master | |
git merge master2 | |
echo fetch $project success | |
done | |
echo batch fetch success! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
const shell = require('shelljs') | |
// 远端工程:必需 | |
const REPOSITORY_NAME = 'trident-node' | |
// 工程地址:必需 | |
const REPOSITORY_URL = `[email protected]:client/${REPOSITORY_NAME}.git` | |
// 远端工程测试上云功能的分支 | |
const REPOSITORY_BRANCH = 'feat/temp-pbkd' | |
const remote = shell.exec(`git remote`).stdout.trim().split('\n') | |
if (!remote.includes('origin2')) { | |
shell.exec(`git remote add origin2 ${REPOSITORY_URL}`) | |
} | |
shell.exec(`git fetch origin2`) | |
shell.exec(`git checkout -b master2 origin2/${REPOSITORY_BRANCH || 'master'}`) | |
shell.exec(`git checkout master`) | |
shell.exec(`git merge master2`) | |
shell.exec(`git branch -D master2`) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment