From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Steinar Bang Newsgroups: gmane.emacs.devel Subject: Re: Stash Date: Mon, 06 Apr 2015 16:53:44 +0200 Organization: Probably a good idea Message-ID: <86zj6l5mvb.fsf@dod.no> References: <86sice77h0.fsf@dod.no> <86fv8d7ntk.fsf@dod.no> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1428332071 1254 80.91.229.3 (6 Apr 2015 14:54:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 6 Apr 2015 14:54:31 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Apr 06 16:54:23 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Yf8Pu-0002zD-8k for ged-emacs-devel@m.gmane.org; Mon, 06 Apr 2015 16:54:22 +0200 Original-Received: from localhost ([::1]:40433 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yf8Pt-0007hq-JZ for ged-emacs-devel@m.gmane.org; Mon, 06 Apr 2015 10:54:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53420) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yf8PK-0007eV-U9 for emacs-devel@gnu.org; Mon, 06 Apr 2015 10:53:48 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yf8PF-0005pr-Tx for emacs-devel@gnu.org; Mon, 06 Apr 2015 10:53:46 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:60408) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yf8PF-0005ph-O5 for emacs-devel@gnu.org; Mon, 06 Apr 2015 10:53:41 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Yf8P8-0002Qp-5a for emacs-devel@gnu.org; Mon, 06 Apr 2015 16:53:34 +0200 Original-Received: from cm-84.208.248.210.getinternet.no ([84.208.248.210]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 06 Apr 2015 16:53:34 +0200 Original-Received: from sb by cm-84.208.248.210.getinternet.no with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 06 Apr 2015 16:53:34 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-devel@gnu.org Original-Lines: 84 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: cm-84.208.248.210.getinternet.no Mail-Copies-To: never User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.4 (windows-nt) Cancel-Lock: sha1:yyniP6pZ3stVEz0WD8CbmsG53bc= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:185038 Archived-At: >>>>> Steinar Bang : >>>>> Richard Stallman : >> I did >>> git reset --hard HEAD >> since I had installed all my changes. >> Then I did 'git pull' and it reported a lot of things. >> Then I did 'git status' which produced this: >> # On branch master >> # Your branch is ahead of 'origin/master' by 2 commits. >> # >> nothing to commit (working directory clean) >> What does that second line "ahead of" mean? > It means that the branch master has two commits that aren't in > origin/master (which is your local copy of what's on savannah). Speficically, it's like this: A git branch is a list of commits, each pointing to its ancestor (except for merge commits, which have two ancestors). Git branches can be (er...) branched, and from the fork of the branch and backwards, the branches are the same. Once you have hold of a commit, you actually have hold of a branch with that commit at its head. Branch names like "master" and "origin/master" are just symbolic names pointing to a particular commit. So what you have (this needs a fixed width font), is: origin/master | v --o<--o<--o<--o<--o ^ | master Ie. there is a chain of commits in your local repository forming a history. The local branch "master" points to one commit, and the branch "origin/master" (which is your local representation of the state on savannah). When you do git fetch changes are fetched from savanna and added to the list pointed to by origin/master (actually, the commits are just added, since they already are pointing back to their ancestor, and origin/master is just changed to point to the newest commit from savannah). If you have no changes on your local branch "master", the master branch can be moved in the same way, ie. "master" can be changed to point to the newest commit from savannah (this is what's known as a "fast forward" merge) If you have commits on your "master", "origin/master" and "master" needs to be merged, just like any branch. What I proposed, was to first create a new branch holding the current state of master, and then reset "master" to point to the same commit as "origin/master": origin/master | v --o<--o<--o<--o<--o ^ ^ | | | two-unexpected-commits-on-master master "origin/master" and "master" are actually files: .git/refs/heads/master .git/refs/remotes/origin/master Inside the files is a sha1 hash uniquely defining a commit.