Thread (5 messages) flat view 5 messages, 2 authors, 2016-06-15

Re: git-rev-tree

From: Linus Torvalds <torvalds@osdl.org>
Date: 2016-06-15 22:42:11


On Mon, 7 Nov 2005, Dave Jones wrote:
Can someone remind me what the deprecated git-rev-tree command did,
or how this should be fixed up to use newer git commands?
It was basically the same as "git-rev-list", except:

 - it output the date (as a raw number) in front, so pretty much everybody 
   ended up using "cut" to remove it, sometimes after sorting the output 
   numerically.

   Sorting numerically is unnecessary with git-rev-list, since the output 
   is already sorted (not necessarily exactly by date, but by "recency" 
   and/or by other even stricter sorting rules)

 - it was limited to a certain number of heads maximum (I forget, but I 
   think it was 16).

 - it parsed the whole tree before outputting anything.
I'm trying to get git-changes-script working, but all the
variants I've found on the web use this deprecated tool.
The git-changes-script was pretty broken.

You're _much_ better off doing it by:

 - fetch the "remote" branch into the local repository. The 
   "git-changes-script" thing required that you fetch the remote branch 
   into _another_ repository, but still local. These days, just use a 
   local branch in the same repo.

   So, for example, tracking my tree

	export KERNEL=master.kernel.org:/pub/scm/linux/kernel/git/
	git fetch $KERNEL/torvalds/linux-2.6 master:linus

   which will just fetch my "master" branch into the local "linus" branch.

 - then just do

	git log linus..HEAD

   and you'll see exactly what you wanted: what exists in your HEAD but 
   not in mine.

No complex script required.

Now, I've told some people that the diffstat is just the same (ie using a 
simple "git diff linus..HEAD | git-apply --stat") but that was because 
I've been muching some really awesomely bad 'shrooms. Clearly that doesn't 
work well at all, since it will show all the stuff I have in my branch 
reversed (since your head doesn't have it). 

The way to get a diff is really to do a merge, and throw the merge away 
after creating the diff. Ie something like this should work:

	git checkout -b merge-branch
	git merge "dummy merge" master linus &&
		git-diff linus.. | git-apply --stat
	git checkout -f master
	git branch -D merge-branch

which will also tell you if the merge failed (in which case you might not 
want to send me a "please pull", but instead try the merge locally and fix 
it up, and then try again)

All of the above is obviously totally untested.

		Linus
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help