Git submodules - Git ignore a file from a subtree but track it locally and push it to a remote production

De openkb
Aller à : Navigation, rechercher

Sommaire

Questions

I have a quite specific workflow and the reason for that is that I use git subtree to include one project inside another:

It should look like this:

code
|--/.git
|--.gitignore
|--/styling
|  |--file1
|  |--file2.v1
|--file3
styling-bare
styling
|--/.git
|--.gitignore
|--file1
|--file2.v2

There are two use cases for the workflow:

    • cd into styling, pull from styling-exchange, then cd into code, update the styling subtree, do some changes to file1 and file2 and file3, push to production
    • cd into code, do some changes to file1 and file2 and file3, push changes to styling-bare (subtree push), cd into styling, pull from styling-bare, push changes to styling-exchange

I would like to have two completely different and separate versions of file2 in the local repositories styling/styling-bare VS the code/production repositories. I need to get all updates from the styling subtree into code/styling, but I need to track file2 just inside code, without any updates from styling.

I.e. I would like to update the styling subtree in the code repository, but keep my own version of file2 when I do that (while having file1 synced between styling and code and file3 synced between code and production), so that I can push my own version (v1) of file2 to production later.

  Is there any elegant way to do that in git without symlinks or some sophisticated hooks?    
 Note, I have experimented with:  

Answers

Suggestions that come to mind :

I woudln t exactly call this elegant, and each method has its flaws.

http://git-scm.com/book/ch7-2.html#Keyword-Expansion http://git-scm.com/book/ch7-2.html#Keyword-Expansion

Source

License : cc by-sa 3.0

http://stackoverflow.com/questions/17260872/git-ignore-a-file-from-a-subtree-but-track-it-locally-and-push-it-to-a-remote

Related

Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Outils