From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Ping Yin" Subject: Re: Any command to simplify 'git fetch origin && git reset --hard origin/master'? Date: Sat, 19 Jan 2008 16:08:55 +0800 Message-ID: <46dff0320801190008p4489b7a2g6153ba7d30f942c3@mail.gmail.com> References: <46dff0320801182122t1581b366yad123407aaad6326@mail.gmail.com> <7vr6ge9tvh.fsf@gitster.siamese.dyndns.org> <46dff0320801190003x622a4f81j1c156f346f5bac03@mail.gmail.com> <7vbq7i9r48.fsf@gitster.siamese.dyndns.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: "Git Mailing List" To: "Junio C Hamano" X-From: git-owner@vger.kernel.org Sat Jan 19 09:09:26 2008 Return-path: Envelope-to: gcvg-git-2@gmane.org Received: from vger.kernel.org ([209.132.176.167]) by lo.gmane.org with esmtp (Exim 4.50) id 1JG8lZ-00052V-He for gcvg-git-2@gmane.org; Sat, 19 Jan 2008 09:09:25 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752055AbYASII5 (ORCPT ); Sat, 19 Jan 2008 03:08:57 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752031AbYASII5 (ORCPT ); Sat, 19 Jan 2008 03:08:57 -0500 Received: from py-out-1112.google.com ([64.233.166.182]:25935 "EHLO py-out-1112.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751240AbYASII4 (ORCPT ); Sat, 19 Jan 2008 03:08:56 -0500 Received: by py-out-1112.google.com with SMTP id u52so1916688pyb.10 for ; Sat, 19 Jan 2008 00:08:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=oo77lnz7wYBfPTmEqjVKOrqWNcMMsGlfjeDGdWS0wyU=; b=KoStGf/XrKG5RBDvzqV2yO8lz7l5JkA1EPCzoGHtIvZ1LPGxkj83zWaHbXj1eIn1zwUWnQNqhPsUQ1FyTlQE7n8wSQfmJnOTd5fSZewKcekHjz/WOlDwDJd50zCIEbs3HcnbOvtw8c+kC5MwJhBE6InxvlNx4n3vSAWolpW9yJg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=BXgcCE1IFuBnVpzSzCRJ9YEyDlaZr8AxGlHQQ3Nd3r3QeleO7F1+LGQWgoslYbxjIALYAVCJTJBT/dxx7UWo5wXb4C9RDE6PEnQqWdCkZPZkg7H7LKJQC6y3EIG77tM2amihoao+mnUdFJimgPvuaDgRtc/COwEXiIe926xRO8Y= Received: by 10.35.12.10 with SMTP id p10mr4876931pyi.36.1200730135509; Sat, 19 Jan 2008 00:08:55 -0800 (PST) Received: by 10.35.108.1 with HTTP; Sat, 19 Jan 2008 00:08:55 -0800 (PST) In-Reply-To: <7vbq7i9r48.fsf@gitster.siamese.dyndns.org> Content-Disposition: inline Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: On Jan 19, 2008 4:06 PM, Junio C Hamano wrote: > > "Ping Yin" writes: > > > On Jan 19, 2008 3:06 PM, Junio C Hamano wrote: > >> "Ping Yin" writes: > >> > >> > I often encounter the case that the origin reposotory is rebased and i > >> > make sure i want to use the origin head as my master > >> > Now I have to do > >> > $ git fetch origin && git reset --hard origin/master > >> > >> The fact you are resetting means you do not have anything > >> interesting in your own branch yourself (--hard will lose your > >> changes and you are willing to lose it), which makes the use > >> case much less interesting, but I can understand a workflow that > >> is based around rebases, as in: > >> > >> $ git fetch origin && git rebase origin/master > >> > > I know 'git pull --rebase' and use it frequently. However, in the case > > i mentioned above, i never do any change in this local branch, i just > > use this branch for deployment which should always keep the same with > > the origin head (just like the remote tracking branch). So i need a > > 'fetch & reset --hard' equivalent, not the 'fetch & rebase' > > equivalent. > > Unless I am misreading you, you did not read what I wrote. > > If you do not have any change on that branch, "git rebase > origin/master" will be equivalent to "git reset --hard > origin/master". > But my case is that the origin head has been rewound. -- Ping Yin