git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Git cheat sheet

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 29, 2007, 08:11 UTC
Message-ID
<7vfy22squc.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<200708290348.02853.zack@kde.org>
Zack Rusin <zack@kde.org> writes:
> http://ktown.kde.org/~zrusin/git/git-cheat-sheet.svg
Nice drawing and no typo.  Very nicely done.

Some minor nits (-), improvement suggestions (+), and corrections (*).

- Recommended form for diff between 1 and 2 is "git diff $id1
  $id2", not dotted form "$id1..$id2"
+ "git log -p $file" gives a false impression that it is about a
  single file.  Better written as "git log -p $file $dir/ec/tory/"
  to suggest both usage.
- Although they do the same thing ("annotate" is there only for
  backward compatibility) "git blame" is recommended over "git
  annotate", if only because that's the command name more often
  talked about in the community.  If you are going to list only
  one, blame is the name to keep.
+ To start from a particular revision, use "git blame $version $file".
- "git reset --hard HEAD"; you do not have to write HEAD there.
- "Revert" has a specific meaning to git but people from
  different background interpret the word differently.  Both
  "git revert HEAD" and "git revert $id" are about creating a
  new commit to reverse the effect of the named commit.
* "git pull $branch1 $branch2" is wrong.  If you are merging
  branch1 into branch2, you need to be on branch2 (i.e. have
  done "git checkout branch2") and then say "git merge branch1".
+ "git commit" is not about publishing at all.  A major point
  about distributed SCMs is that unlike centralized systems, the
  act of committing is separate from the act of publishing.
  IOW, you can make commits without having to worry about
  publishing that to the public, and that allows you to more
  freely experiment.
+ A new section "Making Progress" and include commit, merge and
  rebase there, perhaps?
Previous: Rene HermanNext: Matthieu Moy
Message 3 of 12 in “Git cheat sheet”
  1. Zack RusinAug 29, 2007
  2. Rene HermanAug 29, 2007
  3. Junio C HamanoAug 29, 2007
  4. Matthieu MoyAug 29, 2007
  5. Karl HasselströmAug 29, 2007
  6. Zack RusinAug 29, 2007
  7. Dan ChokolaAug 29, 2007
  8. Matthieu MoyAug 29, 2007
  9. Bernt HansenAug 29, 2007
  10. Bernt HansenAug 30, 2007
  11. Nguyen Thai Ngoc DuyAug 29, 2007
  12. Dan ZwellAug 30, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.