Re: [GIT PULL] kvm oops fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Thu, 19 Apr 2007, Linus Torvalds wrote:
> 
> You can either do
> 
> 	git reset --hard ORIG_HEAD
> 	git reset --hard @{1}

Btw, on the same kind of subject: the whole "what was my previous HEAD" 
issues are obviously also how you'd generally want to see what those 
new patches were, regardless of whether you want to undo them or not.

So it might be worth repeating for people what I do after any pull that I 
feel I want to give a quick look-over.. A simple

	gitk ORIG_HEAD..
or
	gitk HEAD@{1}..
or
	gitk @{1}..
or
	gitk @{12.hours.ago}..

are all variations of the same theme: show what is new since either "last 
update" or "what I had in my tree 12 hours ago".

Btw, the

	gitk @{12.hours.ago}..

thing is very different from

	gitk --since=12.hours.ago

even if they involve the same date.

The "@{12.hours.ago}" syntax pinpoints a particular *commit*, namely what 
your HEAD was pointing at 12 hours ago. So it's literally about your 
particular repository history (give a branch name if you want to specify 
one: so "for-linus@{2.hours.ago}" specifies the *commit* that was the head 
of the "for-linus" branch in your repository 2 hours ago).

In contrast, the "--since=12.hours.ago" means something totally different: 
it measn that you want to ignore all commits that are older than 12 hours, 
regardless of whether they were actually in your tree at that point or 
not. Which is often a very different issue indeed.

So another reasonably common things you can do:

	git fetch linus
	gitk linus@{1}..linus

this assumes that you've set up a separate tracking branch "linus", and 
that you've taught it to fetch my current tree into it. So in the above 
sequence, the "git fetch linus" will fetch everything new from my tree 
into your "linus" tracking branch, and the "gitk" will then show all the 
new commits on that branch that you got.

NOTE! The above is very much designed to work whether you are on that 
branch or not, and in fact, the normal reason to do something like the 
above is explicitly that you want to see what is going on in somebody 
elses tree without actually necessarily merging it into your own branch 
(perhaps in order to decide whether you _want_ to merge it or not).

And that "linus@{1}" really just means "what is the previous commit I had 
on my 'linus' branch". You can obviously dig deeper down, and "linus@{10}" 
is something less commonly used, but basically means "what was on that 
branch ten revision updates ago".

Note that this is *very*different* from "linus~10", which means "what is 
the tenth _parent_ of the "linus" branch. They *can* be the same thing (if 
each operation adds exactly one commit), but if you do things like "git 
fetch", then the "linus" branch ten operations ago may be hundreds of 
commits ago, because some of those ten operations may have added lots of 
commits thanks to synching up with some other tree!

And as already noted, the "branch@{xyzzy}" format also allows "xyzzy" to 
be a date, not just a numeral. In fact, that was the original revlog 
tracking behaviour, and the numeric thing, while simpler, is actually a 
newer feature (as is the "don't specify a branch name at all", which just 
means "current branch")

So

	gitk @{24.hours.ago}..

is a nice way to see what has happend in *your* repository, on the current 
branch, in the last 24 hours.

(NOTE: You can also say "HEAD@{2.hours.ago}" and that actually doesn't use 
the current branch at all, it actually says what HEAD was 2 hours ago: you 
may have been on some totally _different_ branch back then, and if you 
wonder what the heck of a branch you are running and you look at the time 
of the binary, but you don't remember what branch you had checked out when 
you built it, that may be what you want. Of course, you may also want a 
better attention span ;)

Some of this is pretty recent, and generally, if some of this doesn't work 
for you, it means that you are using some ancient version of git. If it's 
not git-1.5.x, upgrade. It's worth it.

		Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux