Skip to content

Commit

Permalink
feat: allow syncing all branches
Browse files Browse the repository at this point in the history
  • Loading branch information
wei committed Sep 11, 2019
1 parent c321233 commit c388e4c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: repo-sync
uses: wei/git-sync@master
uses: wei/git-sync@v1
env:
SOURCE_REPO: ""
SOURCE_BRANCH: ""
Expand All @@ -34,6 +34,10 @@ jobs:
```
`SSH_PRIVATE_KEY` can be omitted if using authenticated HTTPS repo clone urls like `https://username:[email protected]/username/repository.git`.

#### Advanced: Sync all branches

To Sync all branches from source to destination, use `SOURCE_BRANCH: "refs/remotes/source/*"` and `DESTINATION_BRANCH: "refs/heads/*"`. But be careful, branches with the same name including `master` will be overwritten.

### Docker
```
docker run --rm -e "SSH_PRIVATE_KEY=$(cat ~/.ssh/id_rsa)" $(docker build -q .) \
Expand Down
3 changes: 0 additions & 3 deletions git-sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,5 @@ echo "SOURCE=$SOURCE_REPO:$SOURCE_BRANCH"
echo "DESTINATION=$DESTINATION_REPO:$DESTINATION_BRANCH"

git clone "$SOURCE_REPO" --origin source && cd `basename "$SOURCE_REPO" .git`
git checkout "$SOURCE_BRANCH"
git show --name-status
git remote add destination "$DESTINATION_REPO"
git remote -v
git push destination "${SOURCE_BRANCH}:${DESTINATION_BRANCH}" -f

0 comments on commit c388e4c

Please sign in to comment.