Reputation: 35667
This might seem like a weird question, but bear with me.
I'd like to (ab?)use git for a little project I'm working on, where I'd like to branch a file, yet keep the branched file within the current branch under a new name, maintaining history (allowing me to rebase changes to the original). This is similar to Subversion I suppose, in that Subversion doesn't know branches, and just copies.
I'd like to have documents which doubles as document templates (these are plain text files, don't worry merging will be quite possible), and in order to base a new document on another document, I'd like to just branch it.
Is this at all possible with Git? If not (and I'm actually assuming it's not, given Git's structure), are there any conceivable alternatives? I don't want to move away from Git, though, as I use it for much more, so if there's no good solution, I guess I can live with implementing my own (lightweight) branch/rebase on top of it.
Upvotes: 0
Views: 233
Reputation: 25245
git will detect copies of a file for you and track history correctly on them.
Maybe I'm not understanding what you are asking?
Upvotes: 1
Reputation: 77201
You could conceivably mount the same submodule at different places in the directory tree, with different versions mounted. The filename would bethe same, but with different versions. I'm not sure I'd like to be the one maintaining that stuff, though.
Upvotes: 0
Reputation: 81102
What's so wrong with branching? You could pretty easily maintain a "templates" branch and move your changed documents between them.
Say, for example:
git checkout -b templates
git checkout master
git checkout templates path/to/template.ext
cp path/to/template.ext path/to/document.ext
# decide you want to change the template
cp path/to/document.ext path/to/template.ext
git commit -a -m "changed template"
git checkout templates
git merge master
Upvotes: 1