* Git workflow
@ 2008-03-10 12:37 Peter Gordon
2008-03-11 1:58 ` Thomas Harning
2008-03-11 5:15 ` Junio C Hamano
0 siblings, 2 replies; 3+ messages in thread
From: Peter Gordon @ 2008-03-10 12:37 UTC (permalink / raw)
To: git
Hi.
There are a number of us working on a project. We each have a HEAD, and
work on branches, using git-checkout -b MyPatch. When we have finished
working on the branch, we move back to the HEAD, with
git-checkout master, do a
git-pull
and then git-cherry-pick sha1.....
I have two questions.
1) Is this the normal way to work with git.
2) Also, we sometimes get a log of
Merge branch 'master' of git://sgit/MyProject which has no commits. Why
does this happen?
Thanks,
Peter
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Git workflow
2008-03-10 12:37 Git workflow Peter Gordon
@ 2008-03-11 1:58 ` Thomas Harning
2008-03-11 5:15 ` Junio C Hamano
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Harning @ 2008-03-11 1:58 UTC (permalink / raw)
To: Peter Gordon; +Cc: git
On Mon, 10 Mar 2008 14:37:43 +0200
Peter Gordon <peter@pg-consultants.com> wrote:
> Hi.
>
> There are a number of us working on a project. We each have a HEAD,
> and work on branches, using git-checkout -b MyPatch. When we have
> finished working on the branch, we move back to the HEAD, with
> git-checkout master, do a
> git-pull
> and then git-cherry-pick sha1.....
>
> I have two questions.
>
> 1) Is this the normal way to work with git.
Since you always work on your own 'branch', you have no need to check
out a new branch to be independent of others.
If you 'do' work on your own branch, the easier way would be to do one
of the following:
a) git pull
b) Separate branches for separation..
git checkout master
git pull -- may cause a merge
git merge <your branch> -- if you worked on your own branch..git pull
c) Get the latest changes and linearize history
git fetch
git rebase origin/master
a - Easiest and more sane
If you want to work on your own branches you can always
work on that branch and pull updates from the master
b - Might keep workflow simpler and follows your workflow without
cherry-picks
c - Might be good if you create a simple patch and don't care about the
history and haven't published the branch
>
> 2) Also, we sometimes get a log of
> Merge branch 'master' of git://sgit/MyProject which has no commits.
> Why does this happen?
git pull performs explicit merges if your repository is not at the
exact same point as another. Depending on what has happened, there
might be no code changes, but the history is different (perhaps
out-of-order 'cherry-picks')
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Git workflow
2008-03-10 12:37 Git workflow Peter Gordon
2008-03-11 1:58 ` Thomas Harning
@ 2008-03-11 5:15 ` Junio C Hamano
1 sibling, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2008-03-11 5:15 UTC (permalink / raw)
To: Peter Gordon; +Cc: git
Peter Gordon <peter@pg-consultants.com> writes:
> ... When we have finished
> working on the branch, we move back to the HEAD, with
> git-checkout master, do a
> git-pull
> and then git-cherry-pick sha1.....
> ...
> 1) Is this the normal way to work with git.
It does not look "normal" in that I do not see anything that pushes
your change back so others can build on top of it. Also cherry-pick is
valid but it probably is easier to use "git rebase" frontend.
You need to answer one policy question at the project level. Do you want
the shared central repository to be a place for your developers to also
share their not-quite-ready-for-master-work-in-progress?
Assuming you don't, for the sake of simplicity for now, you can simplify
the workflow by dividing it conceptually into two levels:
* shared repository 'master' branch is where everybody meets. Birds-eye
view of what you do is:
(0) git clone;
(1) work locally to advance your 'master';
(2) "git fetch origin", followed by "git rebase remotes/origin" to make
sure your changes come on top of whatever others have done while
you were working in step (1);
(3) "git push origin master", which pushes back your 'master', so that
others can build on what you did in step (1);
(4) go back to (1) to work further.
* because you always push your 'master' in step (3) above, as long as you
have what you want in your 'master' at that point, it does not matter
_how_ you work towards that state in step (1) above.
You can employ local topic branches (or you can use guilt patch stack),
and nobody else needs to know about it. If you have a long-running
work that won't be ready for the shared 'master', you may locally:
(a) "git checkout -b my-topic master";
(b) work locally whenever you find time;
(c) "git checkout master" if you get interrupted and have more urgent
things to do;
(d) "git checkout my-topic" to continue, but from time to time, it
would be a good idea to "git rebase remotes/origin" while on that
branch, and when you are finally done with my-topic, then
(e) after making sure with (2) above that your 'master' is up-to-date,
"git checkout master", "git merge my-topic".
(f) then finally "git push origin master".
But you can consider these steps (a)-(e) merely "implementation
details" of how you would perform (1) above.
Once you got comfortable with the workflow without topics, more advanced
developers among you would find local topic branches handy way to organize
their work. But you do not have to. And if you do not use local topics,
there is no reason to avoid working directly on 'master'.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-03-11 5:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-10 12:37 Git workflow Peter Gordon
2008-03-11 1:58 ` Thomas Harning
2008-03-11 5:15 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).