* how to push from repository with two tracking branches
@ 2010-05-13 9:09 Gelonida
2010-05-13 11:57 ` Jeff King
0 siblings, 1 reply; 3+ messages in thread
From: Gelonida @ 2010-05-13 9:09 UTC (permalink / raw)
To: git
Hi,
I have a repository with two tracking branches ('master' and 'mybranch')
with only one tracking branch I can do
git pull
make_local_changes
git commit -a
git push
with two tracking branches I will be told off if the other branch has
been updated meanwhile, so what I currently to do is:
# 'pull and fastforward mybranch'
git checkout mybranch
git pull
git checkout master
# pull and commit and push as with one tracking branch
git pull
make_local_changes
git commit -a
git push
How can I do this more efficiently?
after a pull to master (I just had to fast forward mybranch to
remote/mybranch)
Switching branches and pulling seems a little clumsy
N
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: how to push from repository with two tracking branches
2010-05-13 9:09 how to push from repository with two tracking branches Gelonida
@ 2010-05-13 11:57 ` Jeff King
2010-05-13 12:12 ` Thomas Rast
0 siblings, 1 reply; 3+ messages in thread
From: Jeff King @ 2010-05-13 11:57 UTC (permalink / raw)
To: Gelonida; +Cc: git
On Thu, May 13, 2010 at 11:09:11AM +0200, Gelonida wrote:
> I have a repository with two tracking branches ('master' and 'mybranch')
>
> with only one tracking branch I can do
> git pull
> make_local_changes
> git commit -a
> git push
>
> with two tracking branches I will be told off if the other branch has
> been updated meanwhile, so what I currently to do is:
How about "git push origin mybranch" to just push mybranch? You might
also want to look at "push.default" in "git help config".
> # 'pull and fastforward mybranch'
> git checkout mybranch
> git pull
> git checkout master
>
> [...]
>
> How can I do this more efficiently?
> after a pull to master (I just had to fast forward mybranch to
> remote/mybranch)
> Switching branches and pulling seems a little clumsy
Pull requires a working tree because a non-fast forward merge may need
to resolve conflicts. So yes, you could be more efficient if it is a
fast-forward (you would "git fetch", check to make sure it is a
fast-forward, and then write the fast-forwarded commit sha1 into the
ref), but in the worst case you may need to actually do the merge.
-Peff
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: how to push from repository with two tracking branches
2010-05-13 11:57 ` Jeff King
@ 2010-05-13 12:12 ` Thomas Rast
0 siblings, 0 replies; 3+ messages in thread
From: Thomas Rast @ 2010-05-13 12:12 UTC (permalink / raw)
To: Gelonida; +Cc: Jeff King, git
Jeff King wrote:
> On Thu, May 13, 2010 at 11:09:11AM +0200, Gelonida wrote:
>
> > I have a repository with two tracking branches ('master' and 'mybranch')
> >
> > with only one tracking branch I can do
> > git pull
> > make_local_changes
> > git commit -a
> > git push
> >
> > with two tracking branches I will be told off if the other branch has
> > been updated meanwhile, so what I currently to do is:
>
> How about "git push origin mybranch" to just push mybranch? You might
> also want to look at "push.default" in "git help config".
Besides, all successful branch updates go through independently of the
ones that failed. So you can push without having all local branches
up to date.
--
Thomas Rast
trast@{inf,student}.ethz.ch
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-05-13 12:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-13 9:09 how to push from repository with two tracking branches Gelonida
2010-05-13 11:57 ` Jeff King
2010-05-13 12:12 ` Thomas Rast
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).