All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gelonida N <gelonida@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>
Subject: Re: best way to fastforward all tracking branches after a fetch
Date: Mon, 12 Dec 2011 11:24:22 +0100	[thread overview]
Message-ID: <4EE5D656.20400@gmail.com> (raw)
In-Reply-To: <4EE5D3CD.6020604@gmail.com>

I forgot one other use case:

- wanting to pull from tracking branches without fastforwarding is not
such a smart idea.

of course I can do
git merge from  remotes/origin/branch
but this is more to type and would vary depending on whether 'd like to
pull from an unpushed tracking branch or from a freshly fetched tracking
branch.


On 12/12/2011 11:13 AM, Gelonida N wrote:
> Thanks for this rather long answer,
> 
> On 12/12/2011 09:09 AM, Junio C Hamano wrote:
>> Gelonida N <gelonida@gmail.com> writes:
>>
>>> What is the best way to fastforward all fastforwardable tracking
>>> branches after a git fetch?
>>
>> This lacks context and invites too many tangents, so I'll only touch a few
>> of them.
>>
>> First of all, why do you want to do this?
>>
> 
> To explain the scenario:
> - small project
> - every person works on master and multiple topic branches
>    and might alternate rather often
> - sometimes several persons work on the same topic branch
>   but most of the time not in parallel.
> - one person is working from several machines (starting work on
>   one and continuing on another)
> - additionally we do many pushed in order to be sure,
>   that our data is backed up in case of disk failures.
> - sometimes I just want to 'build' from a branch, that I am not
>    working on. but there I create mostly not even a tracking branch
> 
> before changing a machine I want to be sure to have pushed everything. I
> wanted to get rid of the warning, that some branches cannot be pushed,
> because they aren't fastforwarded
> 
> when checking out a branch I want to avoid, that I have to pull manually.
> 
> 
> 
>> In other words, wouldn't a post-checkout hook be a better place to do
>> this kind of thing, perhaps like this (completely untested)? 
>>
>>     #!/bin/sh
>>     old=$1 new=$2 kind=$3
>>
>>     # did we checkout a branch?
>>     test "$kind" = 1 || exit 0
>>
>>     # what did we check out?
>>     branch=$(git symbolic-ref HEAD 2>/dev/null) || exit 0
>>
>>     # does it track anything? otherwise nothing needs to be done
>>     upstream=$(git for-each-ref --format='%(upstream)' "$branch")
>>     test -z "$upstream" || exit 0
>>
>>     # are we up-to-date? if so no need to do anything
>>     test 0 = $(git rev-list "..$upstream" | wc -l) && exit 0
>>
>>     # do we have something we made? if so no point trying to fast-forward
>>     test 0 = $(git rev-list "$upstream.." | wc -l) || exit 0
>>
>>     # attempt a fast-forward merge with it
>>     git merge --ff-only @{upstream}
>>
> 
> This is a solution, I wouldn't get rid of the warnings though when
> running git push.
> 

  reply	other threads:[~2011-12-12 10:24 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-10 12:26 best way to fastforward all tracking branches after a fetch Gelonida N
2011-12-11  2:22 ` Sitaram Chamarty
2011-12-11 16:17   ` Gelonida N
2011-12-11 18:22     ` Jakub Narebski
2011-12-11 18:56       ` Sitaram Chamarty
2011-12-11 19:00       ` Andreas Schwab
2011-12-11 19:53         ` Jakub Narebski
2011-12-11 19:58       ` Gelonida N
2011-12-11 20:30         ` Andreas Schwab
2011-12-11 16:27 ` Martin Langhoff
2011-12-11 20:14 ` Stefan Haller
2011-12-11 20:27   ` Gelonida N
2011-12-11 20:43     ` Martin Langhoff
2011-12-11 22:22   ` Hallvard B Furuseth
2011-12-12  7:33     ` Stefan Haller
2011-12-12  8:25       ` Jeff King
2011-12-12  9:19         ` Stefan Haller
2011-12-13 19:05       ` Hallvard Breien Furuseth
2011-12-12  8:28     ` Junio C Hamano
2011-12-12  8:09 ` Junio C Hamano
2011-12-12 10:13   ` Gelonida N
2011-12-12 10:24     ` Gelonida N [this message]
2011-12-17 10:10 ` Sitaram Chamarty
2011-12-17 10:11   ` Sitaram Chamarty
2011-12-19  6:31     ` Nazri Ramliy
2012-01-18  1:50       ` Sitaram Chamarty
2012-01-18  1:48   ` Sitaram Chamarty

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=4EE5D656.20400@gmail.com \
    --to=gelonida@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.