Difference between revisions of "Git"

From eLinux.org
Jump to: navigation, search
m (Additional Resources: merged from git usage)
(Videos: add Ebert git screencast)
 
(16 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Git is a distributed [[Version Control System]] used heavily by the [[Linux Kernel]] Developer Community and many other open source projects,
+
== Introduction ==
 +
Git is a distributed [[Version Control System]] used heavily by the [[Linux Kernel]] Developer Community and many other open source projects.
 +
 
 +
See the [http://en.wikipedia.org/wiki/Git_(software) Wikipedia entry for Git] for a good description.
  
 
Git is distributed: every developer has a copy of the whole project and its history, this doubles as backup as well as makes operations super fast since you don't need to go through network.
 
Git is distributed: every developer has a copy of the whole project and its history, this doubles as backup as well as makes operations super fast since you don't need to go through network.
  
Git is about series of patches that work in a tree form, each tree leaf is a branch. Branches are easy and fast, you can create and delete as much as you wish and you can optionally push them upstream, so it's advised that development happens in your own tree and that you rebase your work on top of upstream 'master', that way you get a consistent sequence of patches to implement features. With Git you can go back in history and edit commits, delete them, reorder or even merge lots of commits into a single commit for publishing, usually required for projects that employ code review.
+
Git is about tracking changes to a set of files in a directory tree, in a way that preserves the history of all changes in a robust way. Git is optimized for fast operation even on very large source repositories, and for distributed operations.  3 main principles of Git are:
 +
# Git is fully distributed - every repository has the complete history (record of every change set, and the state of the full source tree for every single commit)  Each repository operates in a completely local and standalone fashion.  No network operations (e.g. communicating with a master server) are required in order to carry out operations.
 +
# Git supports fast branching - Git intrinsically supports lightweight branching, which promotes speculative or experimental development.  Git allows easy separation of in-progress work from production work.
 +
# Git has powerful changeset management - Git has very flexible changeset editing and easy merging from other repositories. With Git you can go back in history and edit commits, delete them, reorder or even merge lots of commits into a single commit for publishing. You can do fine-grained changeset management (i.e. the ability to commit only a portion of the modifications in the current checked-out tree).  Also, Git has strong support for tracking other repositories with the ability to merge from multiple sources easily, and to merge only some of the commits from a particular source (cherry-picking).
  
  
See [[Flameman/git]] and [[git usage]] for a Tutorial and examples
+
= Resources =
 +
== Web sites ==
 +
* GIT project home page: http://git-scm.org/
  
 +
== Online books ==
 +
* [http://progit.org/book/ Pro Git Book (online, free of cost)]
 +
** This is a great book with lots of diagrams explaining how git works internally.  It is highly recommended to read this when getting started with Git.
 +
* [http://book.git-scm.com/ The Git Community Book]
 +
** This is the canonical reference book for git concepts and usage.
  
 
+
== Reference material ==
 
 
= Additional Resources =
 
* GIT project home page: http://git-scm.org/
 
* GIT for SVN users: http://git.or.cz/course/svn.html
 
* [http://book.git-scm.com/ The Git Community Book]
 
* [http://en.wikipedia.org/wiki/Git_(software) Git wikipedia]
 
 
* [http://www.kernel.org/pub/software/scm/git/docs/ Git online manpages]
 
* [http://www.kernel.org/pub/software/scm/git/docs/ Git online manpages]
 
* [http://jan-krueger.net/development/git-cheat-sheet-extended-edition Git cheat sheet]
 
* [http://jan-krueger.net/development/git-cheat-sheet-extended-edition Git cheat sheet]
* [http://free-electrons.com/pub/video/2008/ols/ols2008-james-bottomley-git.ogg Pratical Guide to Using Git], a tutorial given by the excellent kernel developer James Bottomley at the Ottawa Linux Symposium 2008
+
* [http://www-cs-students.stanford.edu/~blynn/gitmagic/index.html Git Magic] (very comprehensive Guide)
* [http://www.youtube.com/watch?v=4XpnKHJAok8 Google Tech Talk: Linus' Torvalds on Git]
+
* [http://gitready.com/ Git ready - learn git one commit at a time]
 +
* [http://stackoverflow.com/questions/315911/git-for-beginners-the-definitive-practical-guide Git for beginners: The definitive practical guide]
 +
 
 +
== Kernel development with Git ==
 
* [http://www.wlug.org.nz/KernelDevelopmentWithGit Kernel Development with Git]
 
* [http://www.wlug.org.nz/KernelDevelopmentWithGit Kernel Development with Git]
 
* [http://linux.yyz.us/git-howto.html Kernel Hackers' Guide to Git]
 
* [http://linux.yyz.us/git-howto.html Kernel Hackers' Guide to Git]
 
* [http://kerneltrap.org/node/11753 Linux: Debugging with 'git bisect']
 
* [http://kerneltrap.org/node/11753 Linux: Debugging with 'git bisect']
* [http://www-cs-students.stanford.edu/~blynn/gitmagic/index.html Git Magic] (very comprehensive Guide)
 
 
* [http://wireless.kernel.org/en/developers/Documentation/git-guide  Git Guide for Linux Wireless Users and Developers]
 
* [http://wireless.kernel.org/en/developers/Documentation/git-guide  Git Guide for Linux Wireless Users and Developers]
 +
 +
== Videos ==
 +
* [http://www.youtube.com/watch?v=4XpnKHJAok8 Google Tech Talk: Linus' Torvalds on Git]
 +
** This talk is a basic introduction to the motivations for git (including the history around Linus' use of bitkeeper), and mostly about what git is not (not CVS, not subversion).  This talks includes discussion of aspects of git that are different from other version control systems, and why this is important.  ''Warning: Linus has a jovial, apparently arrogant sense of humor, that some find mildly offensive.''
 +
* [http://free-electrons.com/pub/video/2008/ols/ols2008-james-bottomley-git.ogg Pratical Guide to Using Git], a tutorial given by the very experienced kernel developer James Bottomley at the Ottawa Linux Symposium 2008
 +
** This talk has probably the best discussion of practical use of git, and explanation of how git works internally, that I've seen.  I highly recommend following along hands-on with his examples.  This talk helped me understand merges much better
 +
* [http://www.youtube.com/watch?v=8dhZ9BXQgc4 Google Tech Talk: Git: a brief introduction] by Randal Schwartz
 +
** This is a very good introduction to git, giving talk that was complementary to Linus' talk about what git is and what it does at a technical level.
 +
 +
* [http://www.ralfebert.de/blog/tools/git_screencast/ Git screencast] tutorial by Ralf Ebert
 +
** This is a very good tutorial, only 18 minutes long, showing all the essential features of git.
 +
 +
== Help for people coming from other systems ==
 +
* GIT for SVN users: http://git.or.cz/course/svn.html
  
 
= Git Hosting =
 
= Git Hosting =
These sites provide (free) git hosting services:
+
These sites provide (free) hosting services for git-based projects:
 
* [http://repo.or.cz/ http://repo.or.cz/]
 
* [http://repo.or.cz/ http://repo.or.cz/]
 
* [http://gitorious.org/ http://gitorious.org/ ]
 
* [http://gitorious.org/ http://gitorious.org/ ]
Line 34: Line 57:
 
* [http://unfuddle.com/ http://unfuddle.com/]
 
* [http://unfuddle.com/ http://unfuddle.com/]
 
* [http://www.codebasehq.com/ http://www.codebasehq.com/]
 
* [http://www.codebasehq.com/ http://www.codebasehq.com/]
 +
 +
== Local (elinux) Information ==
 +
See [[Flameman/git]] and [[git usage]] for a Tutorial and examples
 +
 +
See also [[Tims Git Notes]]
 +
 +
=== Some tips and tricks ===
 +
 +
==== See history for a sub-portion of the source ====
 +
* You can see the history of a sub-area of a project, with a command like the following:
 +
** gitk v2.6.30.. kernel/debug
 +
** this shows only the commits since v2.6.30 (a tag), and only for the files under kernel/debug
 +
 +
==== See graph of commits in text mode ====
 +
* you can see a graph display of commits using 'git log --graph'
 +
** to make this more readable, shorten the output with '--oneline'
 +
** e.g. git log --graph --oneline v2.6.38.. init
  
 
[[Category:Development Tools]]
 
[[Category:Development Tools]]
 +
[[Category:Git]]

Latest revision as of 15:56, 11 September 2012

Introduction

Git is a distributed Version Control System used heavily by the Linux Kernel Developer Community and many other open source projects.

See the Wikipedia entry for Git for a good description.

Git is distributed: every developer has a copy of the whole project and its history, this doubles as backup as well as makes operations super fast since you don't need to go through network.

Git is about tracking changes to a set of files in a directory tree, in a way that preserves the history of all changes in a robust way. Git is optimized for fast operation even on very large source repositories, and for distributed operations. 3 main principles of Git are:

  1. Git is fully distributed - every repository has the complete history (record of every change set, and the state of the full source tree for every single commit) Each repository operates in a completely local and standalone fashion. No network operations (e.g. communicating with a master server) are required in order to carry out operations.
  2. Git supports fast branching - Git intrinsically supports lightweight branching, which promotes speculative or experimental development. Git allows easy separation of in-progress work from production work.
  3. Git has powerful changeset management - Git has very flexible changeset editing and easy merging from other repositories. With Git you can go back in history and edit commits, delete them, reorder or even merge lots of commits into a single commit for publishing. You can do fine-grained changeset management (i.e. the ability to commit only a portion of the modifications in the current checked-out tree). Also, Git has strong support for tracking other repositories with the ability to merge from multiple sources easily, and to merge only some of the commits from a particular source (cherry-picking).


Resources

Web sites

Online books

Reference material

Kernel development with Git

Videos

  • Google Tech Talk: Linus' Torvalds on Git
    • This talk is a basic introduction to the motivations for git (including the history around Linus' use of bitkeeper), and mostly about what git is not (not CVS, not subversion). This talks includes discussion of aspects of git that are different from other version control systems, and why this is important. Warning: Linus has a jovial, apparently arrogant sense of humor, that some find mildly offensive.
  • Pratical Guide to Using Git, a tutorial given by the very experienced kernel developer James Bottomley at the Ottawa Linux Symposium 2008
    • This talk has probably the best discussion of practical use of git, and explanation of how git works internally, that I've seen. I highly recommend following along hands-on with his examples. This talk helped me understand merges much better
  • Google Tech Talk: Git: a brief introduction by Randal Schwartz
    • This is a very good introduction to git, giving talk that was complementary to Linus' talk about what git is and what it does at a technical level.
  • Git screencast tutorial by Ralf Ebert
    • This is a very good tutorial, only 18 minutes long, showing all the essential features of git.

Help for people coming from other systems

Git Hosting

These sites provide (free) hosting services for git-based projects:

Local (elinux) Information

See Flameman/git and git usage for a Tutorial and examples

See also Tims Git Notes

Some tips and tricks

See history for a sub-portion of the source

  • You can see the history of a sub-area of a project, with a command like the following:
    • gitk v2.6.30.. kernel/debug
    • this shows only the commits since v2.6.30 (a tag), and only for the files under kernel/debug

See graph of commits in text mode

  • you can see a graph display of commits using 'git log --graph'
    • to make this more readable, shorten the output with '--oneline'
    • e.g. git log --graph --oneline v2.6.38.. init