2

Sorry, but this trio of git commands is taxing my intelligence.

Is it possible to set up a group wiki for total newbies to cover these three git commands? What I am trying to learn is how to restore or rollback files and projects to a prior state.

As I have no experience with subversion or other centralized version control software, reference to how they did things differently is unnecessary and often confusing.

Thanks.

gustavotkg
  • 4,099
  • 1
  • 19
  • 29
haziz
  • 12,994
  • 16
  • 54
  • 75
  • There is a ton of documentation and tutorials out there. What have you read that didn't work for you? – Andrew Marshall Nov 19 '11 at 02:47
  • I have read the relevant section of the git scm community book, as well as Pro-Git and have purchased the Peepcode screencast as well as the Peepcode PDF. I also have Swicegoods Pragmatic Guide to Git. I also just bought Loeliger's Version Control with Git, but have yet to read that book. – haziz Nov 19 '11 at 02:55
  • 1
    related question (for git-reset): http://stackoverflow.com/questions/2530060/can-you-explain-what-git-reset-does-in-plain-english/2530073#2530073 – Cascabel Nov 19 '11 at 06:57
  • @haziz: Have you read the manpages? Have you read (and understood) all of the community book and ProGit up until the "relevant section"? (It's hard to imagine all of these would be completely covered in a single section...) These are separate questions, and if you don't understand the documentation you've read, it sounds like you need to back up and read the basics. You could always try the Git parable... http://tom.preston-werner.com/2009/05/19/the-git-parable.html – Cascabel Nov 19 '11 at 07:03
  • @haziz - as written, this question is unanswerable. As *Andrew Marshall* said, show what did and didn't work for you. In other words, write a question that contains specific steps of creating one or more files/branches/whatever, and show the steps that you're trying to accomplish. – kdgregory Nov 19 '11 at 14:19

4 Answers4

3

All the resources you mentioned are quite popular, and I'm surprised you didn't find them helpful. The man pages for each of those commands are probably the most descriptive resource, but are admittedly dry and dense. Here is a brief summary of the difference between the three commands:

  • git revert takes a treeish and creates a new commit undoing the changes made in the given commit

  • git checkout does just that: checks out a treeish. If you pass a branch name, you'll move to the HEAD of that branch, if you pass a non-HEAD commit or tag, you'll enter a "detached HEAD" state. Regardless, your working tree will now be the same as it was at the commit (there are some edge cases here with untracked/new files).

  • git reset takes a treeish, and erases all the commits up to (but not including) the given commit, but without altering the current state of any of the files. That is, the commits are gone, but your working tree remains in the same state. Passing --hard also puts the files back to the state.

(Yes, a treeish is a real thing)

Andrew Marshall
  • 95,083
  • 20
  • 220
  • 214
1

Here is a link may be helpful.
http://book.git-scm.com/4_undoing_in_git_-_reset,_checkout_and_revert.html

Kjuly
  • 34,476
  • 22
  • 104
  • 118
  • 2
    And you also can refer to [http://progit.org/book](http://progit.org/book), and you'll find more docs in [http://git-scm.com/documentation](http://git-scm.com/documentation). – Kjuly Nov 19 '11 at 02:45
  • I have read the relevant section (quite brief) in the git-scm community book as well as some of Pro-Git. I am not kidding when I say this is taxing my intelligence. – haziz Nov 19 '11 at 02:48
  • 1
    Hi @haziz I suggest you build a new project and test the commands' difference. ;) – Kjuly Nov 19 '11 at 02:57
0

Is it possible to set up a group wiki for total newbies to cover these three git commands?

Honestly? Probably, yeah. Definitely, maybe. I've never set up a wiki, though, so I don't know if I'd be able to help you. :P

In all seriousness, though, this link might help you if you haven't seen it before: http://wiki.freegeek.org/index.php/Git_for_dummies

Additionally, check out this question if you haven't parsed it already: Git for beginners: The definitive practical guide

Community
  • 1
  • 1
0

http://progit.org/2011/07/11/reset.html helped me a lot in seeing the similarities and differences between checkout and reset. Revert is a different story that creates a new commit, canceling out another.

johnny
  • 657
  • 7
  • 18