{"thread":{"id":"35764","subject":"Questions on local clone and push back","startedAt":"2014-01-30T05:43:33Z","lastAt":"2014-01-30T14:13:10Z","messageCount":2,"participants":["Arshavir Grigorian","Andrew Keller"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"233917","messageId":"CACdn6eksz0q1+_JHwF=wKP_ziUFzhB5ij93A3-BEap3kosipFg@mail.gmail.com","threadId":"35764","inReplyTo":null,"subject":"Questions on local clone and push back","fromName":"Arshavir Grigorian","fromEmail":"grigorian@gmail.com","sentAt":"2014-01-30T05:43:33Z","receivedAt":"2014-01-30T05:43:33Z","isPatch":false,"sender":{"key":"grigorian@gmail.com","avatar":null},"body":"Hi, I have the following use case - I have a set of files that are used for\nvarious adhoc projects, each project is in its own directory, and the files\nsometime need to be customized/enhanced for a specific project. Ideally\nsome of these enhancements should be merged to a \"central\" place. I realize\nthat this is not the most optimal setup for software development, however\nthese aren't software projects per se and this setup works very well.\nTo this end, I am thinking of creating a git repository in one directory\n(central location), then cloning it (-l -n -s) into another directory in\nhopes of making enhancements there and eventually pushing / merging some of\nthose enhancements back to the central location.\n\nQuestions: 1) is this a good approach to achieving what I need 2) I was\ngetting an error when I tied to run \"git push\" about the branch being\nchecked out and 3) how do I selectively push / merge only certain commits\nback to the \"source\" repository / branch?\n\nI am using pushing / merging interchangeably because I don't know which\naction is more appropriate in this situation.\n\nThis is my first time using git so any insights would be much appreciated.\nTIA\n"},{"id":"233946","messageId":"B7DBC99A-910F-4BBF-90BB-7F0DBFF5E864@kellerfarm.com","threadId":"35764","inReplyTo":"CACdn6eksz0q1+_JHwF=wKP_ziUFzhB5ij93A3-BEap3kosipFg@mail.gmail.com","subject":"Re: Questions on local clone and push back","fromName":"Andrew Keller","fromEmail":"andrew@kellerfarm.com","sentAt":"2014-01-30T14:13:10Z","receivedAt":"2014-01-30T14:13:10Z","isPatch":false,"sender":{"key":"andrew@kellerfarm.com","avatar":"https://avatars.githubusercontent.com/u/304204?v=4"},"body":"On Jan 30, 2014, at 12:43 AM, Arshavir Grigorian <grigorian@gmail.com> wrote:\n\n> 1) is this a good approach to achieving what I need\n\nIf you do not intend to track the parent projects in Git, then yes - that is a good approach.\n\nWith that said, I recommend tracking each parent project in its own Git repository, and track the shared code in yet another Git repository, and link them using submodule references.\n\n> 2) I was getting an error when I tied to run \"git push\" about the branch being checked out and\n\nWhat's the error when you use the more explicit syntax, `git push <remote> <branch>`?  Depending on configuration, simply `git push` might not have all the information it needs to work.\n\n> 3) how do I selectively push / merge only certain commits back to the \"source\" repository / branch?\n\nYou can't.  When pushing, pulling, or merging, you can only deal with subsections of the commit graph.\n\nWith that said, you can rebuild parts of the commit graph using selected commits.  Then, that result can be pushed, pulled, or merged.\n\nIn my experience, you want to avoid picking and choosing commits in the shared repository for each parent project.  Maintaining the shared repository is difficult enough.  I advise that you find a way to make your shared code configurable for each project, such that you can have one \"master\" branch for all, and each project just uses or configures the code differently.  With that said, try to keep your configurations to a minimum (within reason) - in general, the more configurations you have, the more difficult the shared library will be to maintain.\n\nHope that helps,\n - Andrew\n"}]}