Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Git subtree remember or track prefixes automatically?

We have git remote add origin http://... to avoid repeating typing of actual source repo path. But how about git subtree --prefix=...? It is hard to track, remember and unstable typing prefix path for each time when I pull/push subtree content.

Is there any built-in feature to track prefix path automatically?

like image 442
eonil Avatar asked Oct 11 '13 13:10

eonil


People also ask

How does git subtree work?

git subtree allows you to nest a repository as a subdirectory inside another. It's one of the various options for managing project dependencies in Git projects. You add a subtree to an existing repository where the subtree is a reference to another repository URL and branch/tag when you wish to utilize it.

What does git subtree push do?

git subtree split lets you specify a rev other than HEAD. ' git push '(man) lets you specify a mapping between a local thing and a remot ref. So smash those together, and have git subtree push let you specify which local thing to run split on and push the result of that split to the remote ref.

What is git subtree split?

Use git subtree split to extract the files you want to the an intermediate branch in your repository (you have already done this).

How do I create a subtree in git?

Adding a subtreeSpecify the prefix local directory into which you want to pull the subtree. Specify the remote repository URL [of the subtree being pulled in] Specify the remote branch [of the subtree being pulled in] Specify you want to squash all the remote repository's [the subtree's] logs.


1 Answers

There was a contrib done to address writing to a config file that was not part of the original contrib that added subtrees.

Here's a blog about it: Blog about git subtree (with config)

And here's where it was contributed on github.

I recommend if you get that branch that you merge the latest from the main github subtree contrib.

In general, I think this is a good approach. Subtrees are still evolving, and this is one of the missing links. I'd like to also see the last commit id being recorded this way and deprecate the old way of using --rejoin to detect where to start the next split from.

like image 74
johnb003 Avatar answered Sep 30 '22 01:09

johnb003