Re: git default behavior seems odd from a Unix command line point of view
- From
Andrew Schein <andrew@andrewschein.com>
- Date
- May 12, 2009, 20:05 UTC
- Message-ID
- <4e963a650905121305s244309a5vef9eec671d1ee5e@mail.gmail.com>
- In-Reply-To
- <alpine.LNX.2.00.0905121415000.2147@iabervon.org>
> What *is* your use case? What you're doing seems nuts to me (like, you're > going to send out files with this script that someone is in the middle of > editting), but I don't know what you're trying to do.
I am new to git... so my first instinct is to try to reproduce a work flow that I know works with mercurial setup. It is possible that the concepts don't translate correctly. Here goes...
I have a bunch of separate project-related repositories. There are very few users of the system. Most of the time I am the only user. I want a system for syncing my local repositories to a single shared repository. For example some days I work on my laptop, and some days from my desktop. A third "shared/public" repository "on campus" serves as an always available repository that anyone I collaborate with can pull from. Also it is backed up, and for this reason I designate it the "shared" version. So the purpose of the sync.sh script is to synchronize the personal laptop/desktop repository to the on-campus version.
Something I have learned from using mercurial in industry is that when somebody messes up a "public repo" with conflicts they frequently don't clean up the mess. This can be a sign that they have not learned the lessons of cleanliness rather than ill intent. Otherwise (and similarly) this messiness can be caused from not noticing that they have left a mess.
The motivation of having a sync script that is run on each user's local repository is to decrease the likelihood of a mess. This is achieved by first pulling from the common repository and resolving conflicts _before_ "pushing" (note quotations) their changes to the common repository. There is a possibility of a race condition that leaves a conflict on the shared repository, however the risk is diminished.
Finally, I use "push" in quotes because actually the script uses only uses the pull command. This prevents proliferation of branches on the shared repository.
Is there a better way to achieve this in git than the sync.sh script I sent around?
Thanks,
Andy
-- Andrew I. Schein www.andrewschein.com