Re: best way to fastforward all tracking branches after a fetch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andreas Schwab wrote:
> Jakub Narebski <jnareb@xxxxxxxxx> writes:
> 
> > Something like
> >
> >   git for-each-ref '--format=%(refname) %(upstream)' |
> >   while read refname upstream
> >   do
> >   	# there is upstream
> >   	test -n "$upstream" || break

Here you should probably also check if we are already up-to-date:

    	test $(git rev-parse $upstream) = $(git rev-parse $refname) || continue

> >   	# and if fast-forwards
> >   	test $(git merge-base $refname $upstream) = $(git rev-parse $refname) || break
> >   	git update-ref -m "$message" $refname $upstream
> >   done
> 
> You probably meant s/break/continue/.

Yes, sorry about that.

BTW. git-update-ref invocation can be replaced by Sitaram's suggestion:

    	git branch -f $refname $upstream

-- 
Jakub Narebski
Poland
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]