Git, Beginner to Advanced Survey

  • Published on
    16-Apr-2017

  • View
    3.409

  • Download
    2

Embed Size (px)

Transcript

<p>Prezentacja nowego produktu</p> <p>GIT, Beginner to Advanced Survey</p> <p>Rafa RusinTouKhttp://touk.plhttp://rrusin.blogspot.com</p> <p>What is GIT?</p> <p>Global Information Tracker when it works<br />"goddamn idiotic truckload of sh*t": when it breaks</p> <p>Distributed Version Control System<br />Unlike SVN, which is centralized</p> <p>Designed for speed<br />git log, git checkout , git blame are done locally</p> <p>Designed for branching and merging<br />Includes tuned 3 way merge algorithm for resolving conflicts,<br />with handling merges including file renames.</p> <p>Works on data, not on file names (hashes)</p> <p>GIT has Distributed Model</p> <p>Centralized &amp; Distributed model</p> <p>asasdf</p> <p>Getting Started</p> <p>Configuring GIT<br />Create a file ~/.gitconfig and set up user name and email this info may be distributed globally</p> <p>Initialize repositorygit init</p> <p>Open GUIgit gui</p> <p>Stage files for commit and create a commitCommit is stored locally</p> <p>Connecting to External World</p> <p>Cloning remote repositorygit clone git@github.com:rafalrusin/ode-scripts.git (example)There is support for protocols, like ssh and file:git clone ../other-dir, git clone ssh://user@host/full-path-to-project</p> <p>Create local commits</p> <p>Push to remote repositorygit gui / remote / pushNote: It may fail due to not merged newest remote commits. You will need to do fetch, merge and push again. <br /></p> <p>Working with Branches</p> <p>GIT is usable for maintaining forksMerging to latest upstream release is easy</p> <p>Creating a branch from current HEADgit checkout -b NAME</p> <p>Merging other branch into HEADgit merge NAMEIf a confict occurs, use git mergetool (like meld)</p> <p>Rebasing a set of commits onto other headgit rebase onto OTHER_HEAD </p> <p>Advanced Commands</p> <p>Git cherry-pick merge single commit into current HEAD</p> <p>Git stash store local changes to work on other branch</p> <p>Amend last commit update last commit by new changeset</p> <p>Git grep lookup data over indexed files only</p> <p>Git blame provides author and revision for each line of file</p> <p>Git submodules similar to svn:externals, adds possibility of joining different projects into one<br />http://speirs.org/blog/2009/5/11/understanding-git-submodules.html</p> <p>Git apply index - applies a patch and stages it in index</p> <p>Git show - show a diff for commit</p> <p>Git reset hard, git checkout-index -f - drop local changes</p> <p>Publishing Code With GitWeb</p> <p>Bare repositoriesgit clone bare - creates repository without working copy</p> <p>SSH repositories ssh://user@server/full-path-to-repo</p> <p>Native GIT repositories (eg. via gitosis)git@server.com:path/repo.git</p> <p>Configuring project descriptiondescription, README.html, config [gitweb] owner, URL</p> <p>Integrating With Hudson</p> <p>Hudson Continous Integration<br />has GIT support</p> <p>CI builds using GIT have advantageYou can set up Hudson to build multiple branches. Then developers may submit their forked branch to see if they work passes tests. Then if it's OK, they can merge to master. This way you won't have unstable commits in master branch. </p> <p>References</p> <p>Running GIT under Windows (msysgit) <br />http://nathanj.github.com/gitguide/index.html - also explains features of git gui</p> <p>GitHub social coding</p> <p>git.apache.org, github.com/apache</p> <p>Tools - git-scm.com</p> <p>Who uses GIT?Android, Jquery, digg.com, linux kernel, Qt, YUIhttp://en.wikipedia.org/wiki/Git_%28software%29#Projects_using_Git<br /></p>