Skip to content

Commit c388e4c

Browse files
committed
feat: allow syncing all branches
1 parent c321233 commit c388e4c

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
runs-on: ubuntu-latest
2323
steps:
2424
- name: repo-sync
25-
uses: wei/git-sync@master
25+
uses: wei/git-sync@v1
2626
env:
2727
SOURCE_REPO: ""
2828
SOURCE_BRANCH: ""
@@ -34,6 +34,10 @@ jobs:
3434
```
3535
`SSH_PRIVATE_KEY` can be omitted if using authenticated HTTPS repo clone urls like `https://username:[email protected]/username/repository.git`.
3636

37+
#### Advanced: Sync all branches
38+
39+
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.
40+
3741
### Docker
3842
```
3943
docker run --rm -e "SSH_PRIVATE_KEY=$(cat ~/.ssh/id_rsa)" $(docker build -q .) \

git-sync.sh

-3
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,5 @@ echo "SOURCE=$SOURCE_REPO:$SOURCE_BRANCH"
3232
echo "DESTINATION=$DESTINATION_REPO:$DESTINATION_BRANCH"
3333

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

0 commit comments

Comments
 (0)