[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: I broke git again
From: |
Johannes Schindelin |
Subject: |
Re: I broke git again |
Date: |
Mon, 18 Dec 2006 13:24:10 +0100 (CET) |
Hi,
On Mon, 18 Dec 2006, Han-Wen Nienhuys wrote:
> Graham Percival escreveu:
> > This was completely unintentional, please revert.
> > http://git.sv.gnu.org/gitweb/?p=lilypond.git;a=commit;h=3cac541f96771eb56fc4063df3d9a9ac765bc551
>
> I think this is nothing to worry about. Gitweb shows a bogus patch
> when you're merging branches: It shows the diff of what happened in
> the other branch, in this case a couple of bugfixes by Jan and me.
> This has been fixed in recent revisions of Gitweb, IIRC.
I don't know if it has been fixed; I consider it a grave bug.
> > At about 3pm, I tried a git push (to upload that fix)
> > tsubasa:~/usr/src/lilypond gperciva$ git push
> > ssh+git://address@hidden/srv/git/lilypond.git/
> > error: remote 'refs/heads/master' is not a strict subset of local ref
> > 'refs/heads/master'. maybe you are not up-to-date and need to pull first?
> > error: remote 'refs/heads/origin' is not a strict subset of local ref
> > 'refs/heads/origin'. maybe you are not up-to-date and need to pull first?
> > error: remote 'refs/heads/stable/2.10' is not a strict subset of local
> > ref 'refs/heads/stable/2.10'. maybe you are not up-to-date and need to
> > pull first?
> > error: remote 'refs/heads/web/master' is not a strict subset of local
> > ref 'refs/heads/web/master'. maybe you are not up-to-date and need to
> > pull first?
>
> I recommend to set an explicit refspec, this prevents all this garbage
> up here, i.e.
>
> git pull ssh+git://address@hidden/srv/git/lilypond.git/ master:
>
> to get the changes into your own tree and
>
> git push ssh+git://address@hidden/srv/git/lilypond.git/
> master:refs/heads/master
>
> This should go into an alias.
Not an alias. If you want to _always_ only pull the branch master, you
should put it into the git config:
$ git repo-config remote.gnu.fetch master:
$ git repo-config remote.gnu.push master:refs/heads/master
If you already have more than one remote.gnu.fetch entry (like it seems to
be your case), you have to tell repo-config to replace all:
$ git repo-config --replace-all remote.gnu.fetch master:
You can always override the default by saying
$ git push gnu my-new-branch:refs/heads/xxx
Side note: You can say "master" instead of "master:" and
"master:refs/heads/master", since it is clear what you mean.
> Unfortunately, I don't understand the alias mechanism exactly.
Aliasing is almost like bash aliases (almost, since you cannot override
existing commands; git cannot know if you are interactive or if it is a
script, like bash can).
So, if something you really really often do, like looking at the changes
between jneeman branch and what you did, but only in the subdirectory
lily/, such as
$ git diff jneeman lily/
you can add an alias with
$ git repo-config alias.j 'diff jneeman lily/'
and now saying
$ git j
has the same effect.
NOTE! If you do not use the --global option of repo-config, it will only
add the alias in the current repository. If you want to be able to use the
alias everywhere else, you have to say
$ git repo-config --global alias.j [...]
> Johannes, it would be nice if
>
> address@hidden lilypond]$ git pull sav master:
> Already up-to-date.
>
> would print out the completely expanded command. Otherwise, setting up
> aliases is scary (because you never know what you're doing).
I'd rather add the alias in the short form with
$ git repo-config alias.pullsav 'pull sav master:'
If you still insist on knowing exactly what is going on, you can set the
environment variable GIT_TRACE to 1, and git will sputter out plenty of
information.
> I agree that this is confusing, but if you look closely, you'll notice
> the main branch (master) is missing from the messages above.
That is why I always tell push/pull which branch to push/merge
explicitely.
Hth,
Dscho