Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split examples with push and some monorepo questions #55

Open
bvdham opened this issue Mar 15, 2020 · 4 comments
Open

Split examples with push and some monorepo questions #55

bvdham opened this issue Mar 15, 2020 · 4 comments

Comments

@bvdham
Copy link

bvdham commented Mar 15, 2020

I'm not sure if this is the place to ask for some examples while trying to split and push a sub packe to a new repo. Maybe an examples could eventually be added to the main readme.

I'm trying to build my own monorepo https://github.com/symmono/symmono with for example a sub package framework-bundle https://github.com/symmono/framework-bundle.

On the main branch (master) i'm running

# splitsh, trying to split the master branch FrameworkBundle to it's own repo
git splitsh --prefix=packages/Symmono/Bundle/FrameworkBundle

# sha1
0 commits created, 0 commits traversed, in 0s
c5a195e73c6e2317f44fae252c1d2ae3beb323e7
  1. Is there a command to see whats in that sha1?

Now i'm trying to push it to the framework-bundle repo

# at this moment the framework-bundle is an empty repo
# command 1 with respone
git push git@github.com:symmono/framework-bundle.git c5a195e73c6e2317f44fae252c1d2ae3beb323e7

fatal: c5a195e73c6e2317f44fae252c1d2ae3beb323e7 cannot be resolved to branch

# command 2 with respone
git push git@github.com:symmono/framework-bundle.git c5a195e73c6e2317f44fae252c1d2ae3beb323e7:master

error: unable to push to unqualified destination: master
The destination refspec neither matches an existing ref on the remote nor
begins with refs/, and we are unable to guess a prefix based on the source ref.
error: failed to push some refs to 'git@github.com:symmono/framework-bundle.git'

Can't get my head around it how to split and push it to a new repo. And how to push to a branch and is it possible with splitsh to use tags.

  1. How does the --target flag works?
# branch split example
# when reading readme the --target flag shoud automatically create a branch for the split by passing a branch name, when running below command om main master monorepo
git splitsh --prefix=packages/Symmono/Bundle/FrameworkBundle --target=origin/0.1
0 commits created, 0 commits traversed, in 8ms
c5a195e73c6e2317f44fae252c1d2ae3beb323e7

# trying to push to branch
git push git@github.com:symmono/framework-bundle.git c5a195e73c6e2317f44fae252c1d2ae3beb323e7 0.1
error: src refspec 0.1 does not match any.
error: failed to push some refs to 'git@github.com:symmono/framework-bundle.git'

Above split and push commends are apparently not the way to go.

  1. How could i split and push the sha1 to an new repo.
  2. Is it possible to split and push with tags?

Some extra questions

  1. Do you always split of the master branch, when or why to split a branch.
  2. When working with tags, for example v2.1.2 should you work on branch 2.1 and consider the master branch as new released branch. In this example for v2.2?
@dluague
Copy link

dluague commented Jul 6, 2020

I have success using Laravel sh file https://github.com/laravel/framework/blob/7.x/bin/split.sh.

Step 1: Commit everything in your main repo. make sure the sub package you want to split don't have git initialized.
Step 2: Create a new remote repository for the sub package.
Step 3: Edit the necessary information in the Laravel split.sh file.
Step 4: Run the split.sh file.

Note: Run split.sh file every time you have a new commit in your main repo to sync everything in your sub packages.

@bvdham
Copy link
Author

bvdham commented Jul 6, 2020

@dluague Thank you, that could help me out. Question is it also possible to use tags?

@dluague
Copy link

dluague commented Jul 7, 2020

@bvdham you need to use their release.sh for tag support. https://github.com/laravel/framework/blob/7.x/bin/release.sh

@bvdham
Copy link
Author

bvdham commented Nov 30, 2020

Some examples here would be nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants