* Re: Is there a way to lock branches in GIT?
2009-04-23 21:43 Is there a way to lock branches in GIT? ask4thunder
@ 2009-04-24 3:23 ` Daniel Barkalow
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Barkalow @ 2009-04-24 3:23 UTC (permalink / raw)
To: ask4thunder; +Cc: git
On Thu, 23 Apr 2009, ask4thunder wrote:
> 1. If there are 2 user are working and having their own clone and branches
> (not master, other branches). and there is another parent clone with a
> branch (not master). Can these 2 users merge to the parent clone branch at
> the same time? or only one user will be able to merge first and then the
> other. in other words, will the target branch be checkedout to that user
> alone and other user cant checkout that branch or use the checked out
> branch.
You can't merge into a remote repository; you can only move the remote
repository forward. That is, when you "push" to the remote repository, you
replace what it currently there with a commit you supply that's based on
the commit that's there.
Two people can't both push to the same remote repository at the same time,
because each of them will be sending something that the other hasn't based
their commit on. Whoever's second will be refused, and will have to fetch
the other commit and make a merge commit, which is based on both the
commits. Git makes sure, in updating the remote repository, to do the
necessary locking to have one side or the other lose the race cleanly.
> 2. Is there a way to lock branches, so that if a user want to merge his
> changes to a parent branch of another clone, it can be unlocked for him
> alone? Hope you can help me on this.
Not with git program support. Of course, you can use Unix permissions to
get exclusive write access to the branch and prevent another else from
updating it. And, of course, you can have a branch that's always your own
(Linux kernel development works primarily by every developer having one or
many private branches, and it's rare for multiple people to have write
access to the same branch). But there turns out not to be much benefit to
branches that people can sometimes but not always write to, in a system
where everybody has local branches they can always write to regardless of
what other people do.
-Daniel
*This .sig left intentionally blank*
^ permalink raw reply [flat|nested] 2+ messages in thread