[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Stash
From: |
Steinar Bang |
Subject: |
Re: Stash |
Date: |
Mon, 06 Apr 2015 16:53:44 +0200 |
User-agent: |
Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.4 (windows-nt) |
>>>>> Steinar Bang <address@hidden>:
>>>>> Richard Stallman <address@hidden>:
>> 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.
- Re: Stash, (continued)
- Re: Stash, Mathias Megyei, 2015/04/06
- Re: Stash, Eli Zaretskii, 2015/04/06
- Re: Stash, Yuri Khan, 2015/04/06
- Re: Stash, João Távora, 2015/04/06
- Re: Stash, Eli Zaretskii, 2015/04/06
- Re: Stash, Eli Zaretskii, 2015/04/06
- Re: Stash, João Távora, 2015/04/06
- Re: Stash, Eli Zaretskii, 2015/04/06
- Re: Stash, João Távora, 2015/04/06
- Re: Stash, Eli Zaretskii, 2015/04/06
- Re: Stash,
Steinar Bang <=
- Re: Stash, Harald Hanche-Olsen, 2015/04/06
- Re: Stash, Steinar Bang, 2015/04/06
Re: Stash, Richard Stallman, 2015/04/06
- Re: Stash, Eli Zaretskii, 2015/04/06
- Re: Stash, Harald Hanche-Olsen, 2015/04/06
- Re: Stash, Richard Stallman, 2015/04/07
- Re: Stash, Eli Zaretskii, 2015/04/07
- Re: Stash, Stephen J. Turnbull, 2015/04/07
- Re: Stash, Richard Stallman, 2015/04/08
Re: Stash, Richard Stallman, 2015/04/08