All of lore.kernel.org
 help / color / mirror / Atom feed
* Questions on local clone and push back
@ 2014-01-30  5:43 Arshavir Grigorian
  2014-01-30 14:13 ` Andrew Keller
  0 siblings, 1 reply; 2+ messages in thread
From: Arshavir Grigorian @ 2014-01-30  5:43 UTC (permalink / raw)
  To: git

Hi, I have the following use case - I have a set of files that are used for
various adhoc projects, each project is in its own directory, and the files
sometime need to be customized/enhanced for a specific project. Ideally
some of these enhancements should be merged to a "central" place. I realize
that this is not the most optimal setup for software development, however
these aren't software projects per se and this setup works very well.
To this end, I am thinking of creating a git repository in one directory
(central location), then cloning it (-l -n -s) into another directory in
hopes of making enhancements there and eventually pushing / merging some of
those enhancements back to the central location.

Questions: 1) is this a good approach to achieving what I need 2) I was
getting an error when I tied to run "git push" about the branch being
checked out and 3) how do I selectively push / merge only certain commits
back to the "source" repository / branch?

I am using pushing / merging interchangeably because I don't know which
action is more appropriate in this situation.

This is my first time using git so any insights would be much appreciated.
TIA

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Questions on local clone and push back
  2014-01-30  5:43 Questions on local clone and push back Arshavir Grigorian
@ 2014-01-30 14:13 ` Andrew Keller
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Keller @ 2014-01-30 14:13 UTC (permalink / raw)
  To: Arshavir Grigorian; +Cc: git

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-01-30 14:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-30  5:43 Questions on local clone and push back Arshavir Grigorian
2014-01-30 14:13 ` Andrew Keller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.