Re: how to push from repository with two tracking branches
- From
Jeff King <peff@peff.net>
- Date
- May 13, 2010, 11:57 UTC
- Message-ID
- <20100513115747.GC10963@coredump.intra.peff.net>
- In-Reply-To
- <hsgfjn$onv$1@dough.gmane.org>
On Thu, May 13, 2010 at 11:09:11AM +0200, Gelonida wrote:
Show 10 quoted lines
> 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".
Show 11 quoted lines
> # '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