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

[PATCH] Everyday: some examples.

From
Junio C Hamano <junkio@cox.net>
Date
Dec 13, 2005, 00:22 UTC
Message-ID
<7vek4hg824.fsf_-_@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.64.0512120827440.15597@g5.osdl.org>
Linus Torvalds <torvalds@osdl.org> writes:
Show 10 quoted lines
> On Fri, 9 Dec 2005, Junio C Hamano wrote:
>>
>> Exactly.  That's why task oriented list would be most useful.
>> Here is a starter.
>> 
>> 
>> Everyday GIT Cheat Sheet Or Git With 20 Commands
>> ================================================
>
> Would this file perhaps also have examples?
How about...
---
 Documentation/everyday.txt |   72 ++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 68 insertions(+), 4 deletions(-)
44db136cad84c003506e231a38935ca6acba4d7d
diff --git a/Documentation/everyday.txt b/Documentation/everyday.txt
index 5775cd2..ded4d51 100644
--- a/Documentation/everyday.txt
+++ b/Documentation/everyday.txt
@@ -59,9 +59,6 @@ following commands.
 
   * gitlink:git-show-branch[1] to see where you are.
 
-  * gitlink:git-diff[1] and gitlink:git-status[1] to see what
-    you are in the middle of doing.
-
   * gitlink:git-log[1] to see what happened.
 
   * gitlink:git-whatchanged[1] to find out where things have
@@ -70,7 +67,11 @@ following commands.
   * gitlink:git-checkout[1] and gitlink:git-branch[1] to switch
     branches.
 
-  * gitlink:git-update-index[1] to manage the index file.
+  * gitlink:git-add[1] and gitlink:git-update-index[1] to manage
+    the index file.
+
+  * gitlink:git-diff[1] and gitlink:git-status[1] to see what
+    you are in the middle of doing.
 
   * gitlink:git-commit[1] to advance the current branch.
 
@@ -83,6 +84,37 @@ following commands.
   * gitlink:git-rebase[1] to maintain topic branches.
 
 
+Examples
+~~~~~~~~
+
+* Extract a tarball and create a working tree and a new repository to keep track of it.
+------------
+$ tar zxf frotz.tar.gz
+$ cd frotz
+$ git-init-db
+$ git add .
+$ git commit -m 'import of frotz source tree.'
+------------
+
+* Create a topic branch and develop
+------------
+$ git checkout -b private
+$ edit/compile/test
+$ git diff <1>
+$ git checkout -- foo.c <2>
+$ edit/compile/test
+$ git commit -a -s <3>
+$ git checkout master <4>
+$ git pull . private <5>
+
+<1> to see what changes you are committing.
+<2> revert your botched changes in selected path "foo.c".
+<3> commit everything as you have tested.
+<4> switch to the master branch.
+<5> merge a topic branch into your master branch
+------------
+
+
 Individual Developer (Participant)[[Individual Developer (Participant)]]
 ------------------------------------------------------------------------
 
@@ -100,6 +132,38 @@ addition to the ones needed by a standal
     you adopt Linux kernel-style public forum workflow.
 
 
+Examples
+~~~~~~~~
+
+* Clone the upstream and work on it.  Feed changes to upstream.
+------------
+$ git clone git://git.kernel.org/pub/scm/.../torvalds/linux-2.6 my2.6
+$ cd my2.6
+$ edit/compile/test; git commit -a -s <1>
+$ git format-patch master <2>
+$ git pull <3>
+$ git pull git://git.kernel.org/pub/.../jgarzik/libata-dev.git ALL <4>
+
+<1> repeat as needed.
+<2> extract patches from your branch for e-mail submission.
+<3> "pull" fetches from "origin" by default and merges.
+<4> fetch from a specific branch from a specific repository and and merge. 
+------------
+
+* Branch off of a specific tag.
+------------
+$ git checkout -b private2.6.14 v2.6.14 <1>
+$ edit/compile/test; git commit -a
+$ git checkout master
+$ git format-patch -k -m --stdout v2.6.14..private2.6.14 |
+  git am -3 -k <2>
+<1> create a private branch based on a well known (but somewhat behind)
+tag.
+<2> forward port all changes in private2.6.14 branch to master
+branch without formal "merging".
+------------
+
+
 Integrator[[Integrator]]
 ------------------------
 
-- 
0.99.9.GIT
Previous: Junio C HamanoNext: Petr Baudis
Message 23 of 28 in “Re: as promised, docs: git for the confused”
  1. linux@horizon.comDec 9, 2005
  2. Petr BaudisDec 9, 2005
  3. linux@horizon.comDec 9, 2005
  4. Randy.DunlapDec 9, 2005
  5. Junio C HamanoDec 9, 2005
  6. linux@horizon.comDec 9, 2005
  7. Junio C HamanoDec 9, 2005
  8. Linus TorvaldsDec 12, 2005
  9. Timo HirvonenDec 12, 2005
  10. Linus TorvaldsDec 12, 2005
  11. Randal L. SchwartzDec 12, 2005
  12. Joshua N PritikinDec 13, 2005
  13. Randal L. SchwartzDec 13, 2005
  14. Junio C HamanoDec 13, 2005
  15. Linus TorvaldsDec 13, 2005
  16. H. Peter AnvinDec 13, 2005
  17. Junio C HamanoDec 13, 2005
  18. Randal L. SchwartzDec 13, 2005
  19. Tip of the day: archaeologyJunio C Hamano, Dec 13, 2005
  20. Linus TorvaldsDec 13, 2005
  21. Junio C HamanoDec 13, 2005
  22. Junio C HamanoDec 12, 2005
  23. Everyday: some examples.Junio C Hamano, Dec 13, 2005
  24. Petr BaudisDec 9, 2005
  25. linux@horizon.comDec 9, 2005
  26. Junio C HamanoDec 10, 2005
  27. Junio C HamanoDec 10, 2005
  28. linux@horizon.comDec 10, 2005

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.