git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* checking out later commits from rolled back state
@ 2011-11-01 14:36 photoshop_nerd
  2011-11-01 14:56 ` Alexey Shumkin
  2011-11-01 14:58 ` Vincent van Ravesteijn
  0 siblings, 2 replies; 3+ messages in thread
From: photoshop_nerd @ 2011-11-01 14:36 UTC (permalink / raw)
  To: git

Hello, I a m relatively new to git, and my question pertains to moving back
and forth through the history of my commits.

Here is how I open a previous commit:

1)$ git log

2) (get sha1 hash of previous commit)

3)$ git checkout <hash of my previous commit>

the problem is that once I am working with that commit, git log only shows
the hash tags up to the time that the commit was made, but not any of the
later commits. Is there a way to get the hash tags of my later commits when
I am in that rolled back state?

--
View this message in context: http://git.661346.n2.nabble.com/checking-out-later-commits-from-rolled-back-state-tp6951892p6951892.html
Sent from the git mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: checking out later commits from rolled back state
  2011-11-01 14:36 checking out later commits from rolled back state photoshop_nerd
@ 2011-11-01 14:56 ` Alexey Shumkin
  2011-11-01 14:58 ` Vincent van Ravesteijn
  1 sibling, 0 replies; 3+ messages in thread
From: Alexey Shumkin @ 2011-11-01 14:56 UTC (permalink / raw)
  To: photoshop_nerd; +Cc: git

usually, before you checkout a "past" commit you are on a "current"
named branch
so, do
$ git log <branch_you_were_on_before>

In general, most "history" git commands take a commit hash as an
argument and HEAD as a default one if none was specified
(HEAD is always CURRENT commit (you are on), it is a difference of SVN)

when you ran
$ git log
it was, actually, 
$ git log HEAD

Also, you may specify several commits as arguments of git log
It it very usefull to use (in terminal) to see how branches are diverged
(on X/Windows gitk is more pretty)
$ git log --oneline --graph --decorate <branch1> <branch2> <branchN>


There is also  "git reflog" command
RTM git-reflog

> Hello, I a m relatively new to git, and my question pertains to
> moving back and forth through the history of my commits.
> 
> Here is how I open a previous commit:
> 
> 1)$ git log
> 
> 2) (get sha1 hash of previous commit)
> 
> 3)$ git checkout <hash of my previous commit>
> 
> the problem is that once I am working with that commit, git log only
> shows the hash tags up to the time that the commit was made, but not
> any of the later commits. Is there a way to get the hash tags of my
> later commits when I am in that rolled back state?
> 
> --
> View this message in context:
> http://git.661346.n2.nabble.com/checking-out-later-commits-from-rolled-back-state-tp6951892p6951892.html
> Sent from the git mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: checking out later commits from rolled back state
  2011-11-01 14:36 checking out later commits from rolled back state photoshop_nerd
  2011-11-01 14:56 ` Alexey Shumkin
@ 2011-11-01 14:58 ` Vincent van Ravesteijn
  1 sibling, 0 replies; 3+ messages in thread
From: Vincent van Ravesteijn @ 2011-11-01 14:58 UTC (permalink / raw)
  To: photoshop_nerd; +Cc: git

Op 1-11-2011 15:36, photoshop_nerd schreef:
> Hello, I a m relatively new to git, and my question pertains to moving back
> and forth through the history of my commits.
>
> Here is how I open a previous commit:
>
> 1)$ git log
>
> 2) (get sha1 hash of previous commit)
>
> 3)$ git checkout<hash of my previous commit>
>
> the problem is that once I am working with that commit, git log only shows
> the hash tags up to the time that the commit was made, but not any of the
> later commits. Is there a way to get the hash tags of my later commits when
> I am in that rolled back state?
>

If your are on branch 'master':

git log
git checkout <hash of previous commit>

then

"git log master" will show you the log from the tip of the master branch.

Vincent

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-11-01 14:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-01 14:36 checking out later commits from rolled back state photoshop_nerd
2011-11-01 14:56 ` Alexey Shumkin
2011-11-01 14:58 ` Vincent van Ravesteijn

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).