swcarpentry / git-novice

Version Control with Git

Home Page:http://swcarpentry.github.io/git-novice/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem with output in Episode 5, differences between older commits at lines 77-92

jrfep opened this issue · comments

Hello Community!

I was following the steps of the episodes, and when I arrived at episode 5 and tried to check the history of the file I got an error:

git diff HEAD~3 mars.txt
fatal: ambiguous argument 'HEAD~3': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

I can get the output shown on the lesson page if I use git diff HEAD~2 mars.txt.
I don't think I have skipped any steps, is this a typo in the lesson? or something I am missing?
Could someone else confirm this?

@jrfep there should be three commits at that point

$ git commit -m "Start notes on Mars as a base"
$ git commit -m "Add concerns about effects of Mars' moons on Wolfman"
$ git commit -m "Add some initial thoughts on spaceships"

Hi @kekoziar, I agree, there should be three commits, but the head is pointing to the last one, right?, then:

$ git commit -m "Start notes on Mars as a base" # HEAD~2
$ git commit -m "Add concerns about effects of Mars' moons on Wolfman" # HEAD~1
$ git commit -m "Add some initial thoughts on spaceships" # this is HEAD

So HEAD~3 would give an error, as happens in my case.

@jrfep we both missed this when reviewing it.

$ git commit -m "Discuss concerns about Mars' climate for Mummy"

So, there are four commits.

$ git commit -m "Start notes on Mars as a base" 
$ git commit -m "Add concerns about effects of Mars' moons on Wolfman" 
$ git commit -m "Discuss concerns about Mars' climate for Mummy" 
$ git commit -m "Add some initial thoughts on spaceships" 

Ok, now I see it!
Thanks @kekoziar !