merging initial part of a branch?
External kernel projects sometimes work only against major releases--it's easier for their users/testers to find a major release than a random git version, and at least in the early prototype stage, it isn't critical to be working on the tip all the time.
Is there a simple way to say, for example, "merge in all the upstream changes up to v2.6.15"?
It looks like git pull will only update me to the very tip of a branch. I could create a new local branch that stops at v2.6.15, then pull from that. Can I accomplish the same thing somehow with just one git pull? Or is there some other convenient shorthand that I've missed?
--b.
Quoted 7 lines · J. Bruce Fields
External kernel projects sometimes work only against major releases--it's easier for their users/testers to find a major release than a random git version, and at least in the early prototype stage, it isn't critical to be working on the tip all the time.
Is there a simple way to say, for example, "merge in all the upstream changes up to v2.6.15"?
I haven't tried this for some time, but I presume
$ git pull linus tag v2.6.15
would do what you want.
Quoted 6 lines · Junio C Hamano
Quoted 5 lines · J. Bruce Fields
External kernel projects sometimes work only against major releases--it's easier for their users/testers to find a major release than a random git version, and at least in the early prototype stage, it isn't critical to be working on the tip all the time.
Quoted 8 lines
Quoted 2 lines
Is there a simple way to say, for example, "merge in all the upstream changes up to v2.6.15"?
I haven't tried this for some time, but I presume
$ git pull linus tag v2.6.15would do what you want.
Yep! Thanks. The only documentation I can find for this is a slightly obscure bit in the git-pull man page which lists this as a "short-cut" notation. What is it a shortcut for? Is it possible to specify an arbitrary commit in place of the "tag v2.6.15" somehow?
--b.
Quoted 10 lines · J. Bruce Fields
Quoted 5 lines
I haven't tried this for some time, but I presume
$ git pull linus tag v2.6.15would do what you want.
Yep! Thanks. The only documentation I can find for this is a slightly obscure bit in the git-pull man page which lists this as a "short-cut" notation. What is it a shortcut for? Is it possible to specify an arbitrary commit in place of the "tag v2.6.15" somehow?
The phrase "short-hand" refers to "linus" in the above example. I.e. the name of the file in $GIT_DIR/remotes that records the URL (among other things).
You can only say either "branchname" or "tag tagname" for pull, because of the way underlying git native protocol works (it may not be too hard to extend it, but I haven't looked into it nor particularly interested in looking into it at the moment).
Quoted 8 lines · Junio C Hamano
Quoted 6 lines · J. Bruce Fields
Quoted 5 lines
I haven't tried this for some time, but I presume
$ git pull linus tag v2.6.15would do what you want.
Quoted 8 lines
Quoted 4 lines
Yep! Thanks. The only documentation I can find for this is a slightly obscure bit in the git-pull man page which lists this as a "short-cut" notation. What is it a shortcut for? Is it possible to specify an arbitrary commit in place of the "tag v2.6.15" somehow?
The phrase "short-hand" refers to "linus" in the above example. I.e. the name of the file in $GIT_DIR/remotes that records the URL (among other things).
No, I'm referring to the following language:
"Some short-cut notations are also supported.
"For backward compatibility, tag is almost ignored; it just makes the following parameter <tag> to mean a refspec refs/tags/<tag>:refs/tags/<tag>."
That's the only reference I can find to the "tag <tag>" notation, and it's a bit unhelpful as written. (What backward compatibility?)
How about the following?--b.
Documentation/pull-fetch-param.txt +3 -3
@@ -134,9 +134,9 @@ is often useful. + Some short-cut notations are also supported. + -* For backward compatibility, `tag` is almost ignored; - it just makes the following parameter <tag> to mean a - refspec `refs/tags/<tag>:refs/tags/<tag>`. +* `tag <tag>` means the same as `refs/tags/<tag>:refs/tags/<tag>`; + used with pull or fetch, it requests fetching everything up to + the given tag. * A parameter <ref> without a colon is equivalent to <ref>: when pulling/fetching, and <ref>`:`<ref> when pushing. That is, do not store it locally if
Quoted 4 lines · J. Bruce Fields
That's the only reference I can find to the "tag <tag>" notation, and it's a bit unhelpful as written. (What backward compatibility?)
How about the following?--b.
Makes sense. Thanks.
Backward compatibility is that it was only either "<branch>" or "tag <tag>". When heads/branch or tags/tag came later, supporting the separate word form "tag <tag>" was a bit cumbersome but was done for b/c.
Quoted 4 lines · Junio C Hamano
Backward compatibility is that it was only either "<branch>" or "tag <tag>". When heads/branch or tags/tag came later, supporting the separate word form "tag <tag>" was a bit cumbersome but was done for b/c.
Thanks for the explanation, makes sense.
I might try to put together some more extensive documentation patches over the next couple weeks if you're willing to take them. Plain git actually seems to have pretty usable interfaces at this point, but it's not always obvious where to find them....
I also have Yet Another Git Tutorial, at
http://www.fieldses.org/~bfields/kernel/git.html. (Corrections and suggestions welcomed.)
--b.
Quoted 3 lines · J. Bruce Fields
.... Plain git
actually seems to have pretty usable interfaces at this point, but it's not always obvious where to find them....
I share that feeling too, especially in the documentation area.
Last time we had something very nice going on in this thread:
http://thread.gmane.org/gmane.comp.version-control.git/12917
whose the key article is:
http://article.gmane.org/gmane.comp.version-control.git/13360
but the general sentiment was that having another document is making things more confusing and we should try to clarify the main documentation instead. Pasky said aptly:
http://article.gmane.org/gmane.comp.version-control.git/13410
I am not much of a documentation person myself, and I do not have much interaction with people new to git, without which it is hard to know which point is harder to grasp and what documentation pages assume certain things are known to an uninitiated when they should not.
So I would really appreciate documentaiotn patches to clarify the current mess ;-).
Quoted 3 lines
I also have Yet Another Git Tutorial, at
http://www.fieldses.org/~bfields/kernel/git.html. (Corrections and suggestions welcomed.)
The $prefix defaults to $HOME/bin/. Having $bindir on $PATH ought to be enough and exporting GIT_EXEC_PATH is not needd.
Other than that I did not see anything obviously wrong, although I suspect you did not intend to say clone with stgit.
Quoted 4 lines · Junio C Hamano
"J. Bruce Fields" <[email protected]> writes:
but the general sentiment was that having another document is making things more confusing and we should try to clarify the main documentation instead.
Understood. We may need to add documentation here and there, but that needs to be done alongside clarifying the existing text and organization, and without creating unnecessary duplication.
Quoted 2 lines
So I would really appreciate documentaiotn patches to clarify the current mess ;-).
OK. I'll see if I can up with something useful!
Quoted 9 lines
Quoted 3 lines
I also have Yet Another Git Tutorial, at
http://www.fieldses.org/~bfields/kernel/git.html. (Corrections and suggestions welcomed.)The $prefix defaults to $HOME/bin/. Having $bindir on $PATH ought to be enough and exporting
GIT_EXEC_PATHis not needd.Other than that I did not see anything obviously wrong, although I suspect you did not intend to say clone with stgit.
Whoops, right. Thanks for the corrections; I've applied all three.
--b.
Re: [PATCH] new tutorial
In reply to a message not in the archiveQuoted 6 lines · J. Bruce Fields
OK, now to partially contradict this,...
...
I think it makes sense for the main tutorial to address those beginnning users, so with this patch I'm proposing that we moveDocumentation/tutorial.txttoDocumentation/core-tutorial.txtand replace it by a new tutorial.
Well done, and I think this new organization would serve people better.
Quoted 10 lines
**
Documentation/tutorial.txt**
...
Finally,------------------------------------------------
$ git commit -a ------------------------------------------------will prompt you for a commit message, then record the current state of all the files to the repository.
We may want to mention that the canonical commit log message format is a single line "summary phrase", an empty line, and the body of the message. The core does not enforce it, but it is a good practice to get into because that is more compatible with the e-mail workflow. The first line becomes subject and the rest the message body, and we do not want the first line of an multi-line sentence to be on the subject line, with the message body starting in the middle of that sentence.
Quoted 4 lines
This actually pulls from the branch in Bob's repository named "master". Alice could specify a different branch to pull from in a third argument to pull.
...
A bit narrower fill-column settings, please.
Quoted 9 lines
She can do this by creating a temporary branch just for the purpose of studying Bob's changes:
-------------------------------------
$ git branch bob-incoming $ git checkout bob-incoming $ git pull /home/bob/myrepo $ git-whatchanged -p --------------------------------------
Easier would be:
$ git fetch /home/bob/myrepo master:refs/heads/bob-incoming
$ git whatchanged -p HEAD..bob-incomingYou do not have to switch out of your "master" branch only to fetch into a different branch. And it is usually a good discipline not to commit yourself into a branch you use to keep track of foreign branch. Which means you do not do the fixup in bob-incoming branch, but either in your master or another branch:
$ git checkout -b bob-fixup bob-incoming
$ edit
$ git commit -a -m 'Fixup frotz and filfre'Then you can:
$ git checkout master $ git pull . bob-fixup
Quoted 5 lines
Fixing Mistakes
...
-------------------------------------$ git reset --mixed HEAD^ -------------------------------------
I have a mixed feeling on this one. I tend to recommend --soft instead --mixed to people, but both have their pros and cons:
* "reset --mixed HEAD^" reads the HEAD^ tree into the index, so "git diff" shows your changes. However, it *forgets* all the "git add" you did [*1*].
* "reset --soft HEAD^" does not touch the index, so "git diff" would show the same thing as what you would have seen before your reset, which means nothing after a commit you regret about. You need to say "git diff --cached". But it does not forget about "git add".
Quoted 7 lines
$ git-cat-file commit 67ad31933f09677d0fed6ac62287f07441b215c6 tree 4662df01e0e9cfd9b7fab83d7a5234ee651d8804 parent 9e9b26751a5ca7a257b3e1cfb319fe3e4efc663c author J. Bruce Fields <[email protected]> 1137281075 -0500 committer J. Bruce Fields <[email protected]> 1137281075 -0500minor copyediting of recent additions to git-commit and git-reset ...
If this is intended to be a beginner documentation, I'd prefer if it did not talk about cat-file, nor how commit objects are internally represented.
Quoted 7 lines
Note that by default git pull does not fetch new tags; use
-------------------------------------
$ git-fetch --tags -------------------------------------to get all of the tags from a repository.
These days by default "git fetch" (and "git pull") fetches the tags that refer to the commits you fetch as part of regular updates, so this part is mostly redundant. It still is useful to slurp tags that do not belong to the commit chain you are following.
Quoted 6 lines
You can revisit the old state of a tree, and make further modifications if you wish, using git branch:
-------------------------------------
$ git branch stable-release 67ad31933f09677d -------------------------------------
Empirically the first 7 hexdigits are enough (even 5 for small projects such as git itself). In fact, in the linux-2.6 repository itself, it appears 5 hexdigits are enough to identify all 171902 objects (not just commits) uniquely currently, but of course that would not hold true forever. 16 is way overkill and an eyesore.
BTW, I do not see the CC'ed copy on list archives and am wondering why even though I see CC: header in the copy I received...
BTW^2, it might be interesting to do
$ git format-patch -C origin..master
the next time around.
[Footnote]
*1* If we taught the index file how to record "intent to add" (or, "keep an eye on this path for me"), we could fix the implementation of reset --mixed to take advantage of it.
Re: [PATCH] new tutorial
Quoted 3 lines · Junio C Hamano
We may want to mention that the canonical commit log message format is a single line "summary phrase", an empty line, and the body of the message.
Sounds reasonable. After the second mention of "commit -a" I've added:
A note on commit messages: though not required, it's a good idea to begin the commit message with a single short (less than 50 character) line summarizing the change, followed by a blank line and then a more thorough description. Tools that turn commits into email, for example, use the first line on the Subject line and the rest of the commit in the body.
(Alternatively, if we had more of this sort of thing we could collect them into a "best practices" document to reference at the end.)
Quoted 1 line
A bit narrower fill-column settings, please.
Does 70 characters work for you?
And thanks for the rest of the comments; I'll work through them and then send an update. (May be a few days.) I'll assume you want a replacement unless you tell me you'd prefer an incremental diff.
This caught my eye:
Quoted 4 lines
Empirically the first 7 hexdigits are enough (even 5 for small projects such as git itself). In fact, in the linux-2.6 repository itself, it appears 5 hexdigits are enough to identify all 171902 objects (not just commits) uniquely currently
Five hex digits is only 20 bits, and 171902/2^20 > 1/10, so each additional object has a better than 1-in-10 chance of colliding with an existing object. The chances there hasn't been a collision in the first 5 digits by now must be practically zero. Maybe you're thinking bytes, not hex digits? Unless my math is wrong.
But for these purposes we're just worried about the chance of a particular string having a collision, which should be more like (number of objects) / 2^(4*number of digits), so yeah, 16 digits is overkill, good point.
Quoted 2 lines
BTW, I do not see the CC'ed copy on list archives and am wondering why even though I see CC: header in the copy I received...
Maybe the list software didn't like the big patch?
Quoted 5 lines
BTW^2, it might be interesting to do
$ git format-patch -C origin..masterthe next time around.
Oh, I see, it catches the rename then. Neat.
--b.
Re: [PATCH] new tutorial
Quoted 10 lines · J. Bruce Fields
Quoted 4 lines
Empirically the first 7 hexdigits are enough (even 5 for small projects such as git itself). In fact, in the linux-2.6 repository itself, it appears 5 hexdigits are enough to identify all 171902 objects (not just commits) uniquely currently
Five hex digits is only 20 bits, and 171902/2^20 > 1/10, so each additional object has a better than 1-in-10 chance of colliding with an existing object. The chances there hasn't been a collision in the first 5 digits by now must be practically zero. Maybe you're thinking bytes, not hex digits? Unless my math is wrong.
Your math is right and my script was wrong.
For linux-2.6 repository:
$ git rev-list --objects HEAD | sort >/var/tmp/objnames
$ wc -l </var/tmp/objnames
171902
$ sed -e 's/^\(........\).*/\1/' </var/tmp/objnames | uniq | wc -l
171899
$ sed -e 's/^\(.........\).*/\1/' </var/tmp/objnames | uniq | wc -l
171902So 8 is enough for most but not all objects; you need 9 to uniquely cover everybody.
Quoted 12 lines · Junio C Hamano
Quoted 7 lines · J. Bruce Fields
External kernel projects sometimes work only against major releases--it's easier for their users/testers to find a major release than a random git version, and at least in the early prototype stage, it isn't critical to be working on the tip all the time.
Is there a simple way to say, for example, "merge in all the upstream changes up to v2.6.15"?
Quoted 6 lines
I haven't tried this for some time, but I presume
$ git pull linus tag v2.6.15would do what you want.
If it doesn't you might be able to do
$ git format-patch -m -k v2.6.14..v2.6.15 --stdout > mega-mbox-patch $ git checkout our-own-branch $ git am -3 -k mega-mbox-patch
That'll take some time though, so be sure to have a six-pack or two handy.
Signature · 3 lines
Andreas Ericsson [email protected] OP5 AB www.op5.se Tel: +46 8-230225 Fax: +46 8-230231
Quoted 6 lines · Andreas Ericsson
Quoted 3 lines · Junio C Hamano
I haven't tried this for some time, but I presume
$ git pull linus tag v2.6.15 would do what you want.
Quoted 7 lines
If it doesn't you might be able to do
$ git format-patch -m -k v2.6.14..v2.6.15 --stdout > mega-mbox-patch $ git checkout our-own-branch $ git am -3 -k mega-mbox-patchThat'll take some time though, so be sure to have a six-pack or two handy.
I do not think that should be done. You will create an alternate history that way, not the true v2.6.15 history.
Quoted 16 lines · Junio C Hamano
Quoted 13 lines · Andreas Ericsson
Quoted 3 lines · Junio C Hamano
I haven't tried this for some time, but I presume
$ git pull linus tag v2.6.15 would do what you want.If it doesn't you might be able to do
$ git format-patch -m -k v2.6.14..v2.6.15 --stdout > mega-mbox-patch $ git checkout our-own-branch $ git am -3 -k mega-mbox-patch
Quoted 6 lines
Quoted 1 line
That'll take some time though, so be sure to have a six-pack or two handy.
I do not think that should be done. You will create an alternate history that way, not the true v2.6.15 history.
I took their request to mean that they already have patches of their own in that, so they'll never have v2.6.15 vanilla history anyway.
Signature · 3 lines
Andreas Ericsson [email protected] OP5 AB www.op5.se Tel: +46 8-230225 Fax: +46 8-230231
Quoted 9 lines · Andreas Ericsson
Quoted 8 lines · Junio C Hamano
Quoted 5 lines · Andreas Ericsson
$ git format-patch -m -k v2.6.14..v2.6.15 --stdout > mega-mbox-patch $ git checkout our-own-branch $ git am -3 -k mega-mbox-patchThat'll take some time though, so be sure to have a six-pack or two handy.
Quoted 6 lines
Quoted 3 lines
I do not think that should be done. You will create an alternate history that way, not the true v2.6.15 history.
I took their request to mean that they already have patches of their own in that, so they'll never have v2.6.15 vanilla history anyway.
If I have some local changes, and do a git pull linus tag v2.6.15, I find that the final commit in the result is a merge commit whose first parent refers to my last commit, and whose second commit points to Linus's v2.6.15 commit from the "vanilla history". Which is what I think you really need for a history that makes sense and that can be used by future merges.
--b.
Re: [PATCH] new tutorial
In reply to Junio C HamanoQuoted 2 lines · Junio C Hamano
I have a mixed feeling on this one. I tend to recommend --soft instead --mixed to people, but both have their pros and cons:
Yeah. My goal here is to pare this down to the minimum of text required to get people up and running and having fun. To that end, I'd rather just not explain what the index file is or how it's used. And really git-reset could probably be left out entirely. So I've cut most of this out, and left just one mention of git-reset --hard.
Quoted 3 lines
If this is intended to be a beginner documentation, I'd prefer if it did not talk about cat-file, nor how commit objects are internally represented.
Fair enough. I was trying to find a way to show the structure of the commit graph. But that was probably overkill.
So I've cut that out. I've also left out discussion of the SHA1's entirely, though we might want to add that back in at some point. For now it seems you can do enough without paying attention to them.
Quoted 3 lines
These days by default "git fetch" (and "git pull") fetches the tags that refer to the commits you fetch as part of regular updates, so this part is mostly redundant.
Got it.
Quoted 5 lines
BTW^2, it might be interesting to do
$ git format-patch -C origin..masterthe next time around.
Here's take two.--b.
The current Documentation/tutorial.txt concentrates on the lower-level git interfaces. So it's useful to people developing alternative porcelains, to advanced users, etc., but not so much to beginning users.
I think it makes sense for the main tutorial to address those beginnning users, so with this patch I'm proposing that we move Documentation/tutorial.txt to Documentation/core-tutorial.txt and replace it by a new tutorial.
---
Documentation/core-tutorial.txt | 0
Documentation/tutorial.txt | 2023 ++++++---------------------------------
2 files changed, 303 insertions(+), 1720 deletions(-)
copy Documentation/{tutorial.txt => core-tutorial.txt} (100%)99f6a432f3a4da666d3f535e78cba04085aa1b46
Documentation/core-tutorial.txt renamed from Documentation/tutorial.txt +0 -0
Documentation/tutorial.txt +303 -1720
2,124 lines not on this page · raw message
Signature · 1 line
0.99.8b-g58e3