[Top][All Lists]

[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 08:50:15 +0200
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.4 (windows-nt)

>>>>> 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).

> Is it a problem?

I don't think so.  I think they are probably artifacts of two of the
pull commands done, so I think you probably won't need them.

The following is a way to remove the two commits from master in your git
repository, but at the same time put them in a local branch, where they
can be examined later:
 git checkout -b two-unexpected-commits-on-master
 git checkout master
 git fetch
 git reset --hard origin/master

If you decide ahead of time that you don't care about the two commits,
drop the first command ("git checkout -b two-unexpected-commits-on-master").

Note that the "git reset --hard origin/master" is a particularily
dangerous command, because it will make the branch you're currently on a
copy of the branch in the argument, overwriting any commits you may have
had (I've trashed my feature branch in this way at least once, this is
why I always checkout the branch I'm going to run the command on, even
if I'm already there).p

However, in this case "git reset --hard origin/master" does what you
want: make master a priestine copy of what's currently on savannah.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]