git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Questions on local clone and push back

From
Andrew Keller <andrew@kellerfarm.com>
Date
Jan 30, 2014, 14:13 UTC
Message-ID
<B7DBC99A-910F-4BBF-90BB-7F0DBFF5E864@kellerfarm.com>
In-Reply-To
<CACdn6eksz0q1+_JHwF=wKP_ziUFzhB5ij93A3-BEap3kosipFg@mail.gmail.com>
On Jan 30, 2014, at 12:43 AM, Arshavir Grigorian <grigorian@gmail.com> wrote:
> 1) is this a good approach to achieving what I need
If you do not intend to track the parent projects in Git, then yes - that is a good approach.
With 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.
> 2) I was getting an error when I tied to run "git push" about the branch being checked out and
What'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.
> 3) how do I selectively push / merge only certain commits back to the "source" repository / branch?
You can't.  When pushing, pulling, or merging, you can only deal with subsections of the commit graph.
With that said, you can rebuild parts of the commit graph using selected commits.  Then, that result can be pushed, pulled, or merged.
In 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.
Hope that helps,
 - Andrew
Previous: Arshavir Grigorian
Message 2 of 2 in “Questions on local clone and push back”
  1. Arshavir GrigorianJan 30, 2014
  2. Andrew KellerJan 30, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.