question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Does this work with git-subtree?

See original GitHub issue

Will this action work with subdirectories already pushed (and rejoined using --rejoin) to other repos using git subtree split/push? I have an existing monorepo with subdirs that have their own subtree-maintained repositories. But I want to be sure that this action would maintain the history as created by git-subtree.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jasonkarnscommented, Jun 15, 2020

Thanks for the discussion! I’m going to close this for now, since it seems that generally the use cases don’t align exactly. It would be cool to see an implementation that allowed users to ā€œopt-inā€ to 100% subtree compatible usage. But I suspect the cost/benefit doesn’t make the feature quite worth it.

1reaction
jasonkarnscommented, Jun 15, 2020

So notably, there’s no guarantee that the files people are interested in pushing are actually checked-in to git, so using git-subtree wouldn’t work for all use-cases.

šŸ‘ that makes sense

i’ve previously used submodules rather than git-subtree, though i can see the appeal of subtree over submodules here.

Yep, subtree is a bit simpler for many of the similar use-cases. The biggest benefit being that cloning a repo that uses subtrees doesn’t require any special commands or options (like recursing). The subtree directories are regular old directories.

(A feature that’s lost with subtree is that commits between the subdir-containing-monorepo and the subdir-as-root-repo have different shas, because pushing/pulling between them essentially re-plays commits. If having identical shas is important, then submodules are necessary.)

I’ll have to give it some thought, i’m not sure whether creating an action really provides much benefit over specifying the subtree commands directly in an actions file like you have.

Yep, I think the primary benefit would just be a more declarative configuration. A single-line ā€œuses: actionā€ declaration is more clear than a few lines of obscure and interpolated shell commands 😸 . But I agree, the benefit is slight.

how does the auth work for your linked workflow?

The checkout action (as of v2), persists the auth token into the local git configuration. So the repo token configured here is the same one used for all subsequent git operations. Instead of using the default generated token (which has read access to its ā€œownā€ repo) we use a token that has write access on the remotes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Git Subtree: Alternative to Git Submodule | Atlassian Git Tutorial
git subtree lets you nest one repository inside another as a sub-directory. It is one of several ways Git projects can manage project...
Read more >
Git - Subtree - GeeksforGeeks
git subtree allows you to nest a repository as a subdirectory inside another. It's one of the various options for managing project dependenciesĀ ......
Read more >
When to use git subtree? - Stack Overflow
The benefit of using subtree merge is that it requires less administrative burden from the users of your repository. It works with older...
Read more >
Git Subtree basics - gists Ā· GitHub
When you want to use a subtree, you add the subtree to an existing repository where the subtree is a reference to another...
Read more >
How to Use Git Subtrees - Better Programming
Git subtree is a copy of a Git repository pulled into a parent one. Git submodule is a pointer to a specific commit...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found