From: Neal Kreitzinger <nkreitzinger@gmail.com>
To: Hilco Wijbenga <hilco.wijbenga@gmail.com>
Cc: Git Users <git@vger.kernel.org>
Subject: Re: Linear history *and* share a branch?
Date: Tue, 10 Apr 2012 18:54:54 -0500 [thread overview]
Message-ID: <4F84C84E.1060602@gmail.com> (raw)
In-Reply-To: <CAE1pOi0-uSaQwgJHMTkw3nqp=idxZxMbyfKtLni0=Xwu-L-_hA@mail.gmail.com>
On 4/5/2012 3:48 PM, Hilco Wijbenga wrote:
> Hi all,
>
> We have been using Git for about a year now in a very small team. So
> far, everyone has worked on their own local branches and been doing
> "git rebase master" to make sure their local branches stay in synch.
> This way we have a nice linear history in master.
>
> Recently, it has become useful to share one of these local branches
> between two devs. Of course, when one of the devs does his usual
> "git rebase master", he screws up the other dev's environment. Our
> solution has been to keep rebasing the shared branch but to actually
> work on a local branch that is rebased on the shared branch. By
> judiciously using "git reset" and "git pull" on the shared branch the
> two devs can keep the shared branch in synch and then use "git
> rebase shared-branch" on their local branch to keep it in synch to.
> While this works, there is probably a better/simpler solution.
>
> Should we simply do "git merge master" instead of "git rebase
> master"? And then do something at the end when we are about to merge
> the shared branch back into master to guarantee linear history? Your
> thoughts and ideas would be greatly appreciated.
>
I haven't tried this, but at the point when your topic branch is ready
for master and the only thing left to do is make the history linear
before publishing it you could: rebuild the branch using cherry pick.
You could cherry pick only the merge-commits over and that would drop
all the merge history. You would end up with linear history. Then you
could further cleanup that linear history with rebase -i before you
publish it.
I haven't tried cherry picking a merge commit so I'm assuming it only
brings over the commit content and not the merge history.
v/r,
neal
prev parent reply other threads:[~2012-04-10 23:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-05 20:48 Linear history *and* share a branch? Hilco Wijbenga
2012-04-05 20:56 ` Ævar Arnfjörð Bjarmason
2012-04-06 10:04 ` Ævar Arnfjörð Bjarmason
2012-04-05 21:06 ` Junio C Hamano
2012-04-05 21:57 ` Hilco Wijbenga
2012-04-06 2:44 ` Michael Witten
2012-04-10 23:54 ` Neal Kreitzinger [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F84C84E.1060602@gmail.com \
--to=nkreitzinger@gmail.com \
--cc=git@vger.kernel.org \
--cc=hilco.wijbenga@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).