From: Nicolas Pitre <nico@cam.org>
To: git@vger.kernel.org
Subject: confusion over the new branch and merge config
Date: Thu, 21 Dec 2006 17:17:02 -0500 (EST) [thread overview]
Message-ID: <Pine.LNX.4.64.0612211555210.18171@xanadu.home> (raw)
OK I know I'm a total idiot and honnestly I didn't look at the code
implementation at all because I don't expect newbies to even look there.
But here's some pitfalls I'm sure people are likely to encounter...
$ git clone git://git.kernel.org/pub/scm/git/git.git git
Initialized empty Git repository in /home/nico/test/git/.git/
remote: Generating pack...
remote: Done counting 34527 objects.
remote: Deltifying 34527 objects.
remote: 100% (34527/34527) done
Indexing 34527 objects.
remote: Total 34527, written 34527 (delta 23920), reused 34111 (delta 23623)
100% (34527/34527) done
Resolving 23920 deltas.
100% (23920/23920) done
Checking files out...
100% (748/748) done
[ wooh! I feel good ]
$ cd git
$ git branch
* master
[ Hmmm... there used to be many more (remote) branches before. Where
are they? Looking into .git/refs I see a remote/ directory and all
remote branches are there. But I'm cheating now because a newbie
might not even think of looking there.
Ah? there is -a and -r options to git-branch. Fair enough. ]
$ git branch -r
* master
origin/HEAD
origin/html
origin/maint
origin/man
origin/master
origin/next
origin/pu
origin/todo
$ git checkout next
error: pathspec 'next' did not match any file(s) known to git.
Did you forget to 'git add'?
[ WTF!?!? This definitely used to work before. OK it is listed as
"origin/next" so let's try to be consistent. ]
$ git checkout origin/next
git checkout: to checkout the requested commit you need to specify
a name for a new branch which is created and switched to
[ Hmmmmmmmm.... /me stares at the message wondering.
I just want to _see_ and maybe _install_ the code from "next". ]
$ git checkout origin/next local_next
error: pathspec 'local_next' did not match any file(s) known to git.
Did you forget to 'git add'?
[ But it just said to me above that I needed to provide a name for the
branch to be switched to... Why doesn't it just work? F***ing tool!
OK I'll use my git knowledge and cheat again. ]
$ git checkout -b local_next origin/next
This is I think a good example where user experience might still be
improved. First the message about "providing a name for a new branch"
could certainly be less anbigous.
Then the "next" branch name could possibly be made to work without the
"origin/" if there is no conflict?
And there was a discussion about allowing checkouts to be made from a
remote branch but not allowing any commit on it. What happened of this
idea?
Now that I have my local_next branch, I want it to be kept up to date
when performing a pull. Before the "next" branch sort of was always
updated, but now it is a separate thing I cannot see directly and I need
to pull it in my local version.
$ git pull origin/next
fatal: The remote end hung up unexpectedly
Cannot get the repository state from git://git.kernel.org/pub/scm/git/git.git/next
[ WTF? Where that ...pub/scm/git/git.git/next comes from? Hmmm... ]
$ git pull next
fatal: 'next': unable to chdir or not a git archive
fatal: The remote end hung up unexpectedly
Cannot get the repository state from next
[ ... an even more interesting set of error messages.
Yeah, Linus says you must use git-pull . blah syntax. ]
$ git pull . next
error: no such remote ref refs/heads/next
Fetch failure: .
$ git pull . origin/next
error: no such remote ref refs/heads/origin/next
Fetch failure: .
[ F**K YOU STUPID TOOL !!! OK let's cheat a bit again. ]
$ git pull . remotes/origin/next
Already up-to-date.
[ Woooh! But since I always hated this syntax let's try merge instead. ]
$ git merge origin/next
Already up-to-date.
OK here again various error messages could be improved. The fact that a
remote connection was established in some cases is really dubious. And
git-pull not accepting "origin/next" is IMHO a bug.
Well well... But I don't want to perform this two-step
git-pull+git-merge all the time. So let's have a look at this promising
warning:
$ git pull origin
Warning: No merge candidate found because value of config option
"branch.local_next.merge" does not match any remote branch fetched.
No changes.
So this means that branch.local_next.merge should be set to origin/next?
Let's have a look at the default in .git/config:
[remote "origin"]
url = git://git.kernel.org/pub/scm/git/git.git
fetch = refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
But according to the warning above, branch.master.merge should have been
set to refs/remotes/origin/master, not refs/heads/master, right?
Otherwise does this mean that master will merge itself into itself?
This is where my own git experience stops as I don't understand the
above for real. So let's see the doc:
|branch.<name>.merge::
| When in branch <name>, it tells `git fetch` the default refspec to
| be marked for merging in FETCH_HEAD. The value has exactly to match
| a remote part of one of the refspecs which are fetched from the remote
| given by "branch.<name>.remote".
| The merge information is used by `git pull` (which at first calls
| `git fetch`) to lookup the default branch for merging. Without
| this option, `git pull` defaults to merge the first refspec fetched.
| Specify multiple values to get an octopus merge.
Hmmmmmmm... Even after reading this twice I'm still not sure what it
really means. But as I said at the top I'm an idiot.
Nicolas
next reply other threads:[~2006-12-21 22:17 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-21 22:17 Nicolas Pitre [this message]
2006-12-21 23:01 ` confusion over the new branch and merge config Junio C Hamano
2006-12-21 23:21 ` Sean
2006-12-22 0:39 ` Junio C Hamano
2006-12-22 0:46 ` Junio C Hamano
2006-12-22 1:01 ` Sean
2006-12-22 8:31 ` Andy Parkins
2006-12-22 7:50 ` Alan Chandler
2006-12-22 8:21 ` Junio C Hamano
2006-12-22 8:39 ` Andy Parkins
2006-12-22 15:25 ` Alan Chandler
2006-12-22 20:49 ` Nicolas Pitre
2006-12-22 21:04 ` Jakub Narebski
2006-12-22 21:20 ` Nicolas Pitre
2006-12-22 22:40 ` Jakub Narebski
2006-12-22 23:39 ` Junio C Hamano
2006-12-23 3:10 ` Tom Prince
2006-12-23 5:11 ` Nicolas Pitre
2006-12-23 5:12 ` Jeff King
2006-12-23 5:29 ` Nicolas Pitre
2006-12-23 6:15 ` Junio C Hamano
2006-12-23 6:22 ` Shawn Pearce
2006-12-23 6:28 ` Jeff King
2006-12-23 7:11 ` Junio C Hamano
2006-12-23 7:25 ` Jeff King
2006-12-23 9:51 ` Junio C Hamano
2006-12-23 10:40 ` Jakub Narebski
2006-12-23 15:58 ` Johannes Schindelin
2006-12-23 22:48 ` Jakub Narebski
2006-12-24 6:15 ` Jeff King
2006-12-24 20:49 ` Nicolas Pitre
2006-12-26 7:33 ` Jeff King
2007-01-02 14:49 ` Jeff King
2007-01-02 17:32 ` Junio C Hamano
2007-01-02 17:34 ` Jeff King
2007-01-02 20:04 ` Junio C Hamano
2007-01-02 20:30 ` Jakub Narebski
2007-01-03 0:24 ` Santi Béjar
2007-01-03 23:02 ` Jakub Narebski
2007-01-09 15:05 ` Jeff King
2007-01-09 16:18 ` Jeff King
2006-12-23 8:31 ` Jakub Narebski
2006-12-22 8:41 ` Andy Parkins
2006-12-22 9:39 ` Lars Hjemli
2006-12-22 15:10 ` Nicolas Pitre
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0612211555210.18171@xanadu.home \
--to=nico@cam.org \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).