1 / 12

Git – An introduction

Git – An introduction. August 28, 2013 ASU SoDA. What is Git ?. Version Control Free and Open Source Distributed. !=. http://git-scm.com/downloads/logos , https://github.com/logos. Without Version Control. Two programmers, one program Changes collide Harry’s changes are lost

pia
Télécharger la présentation

Git – An introduction

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Git – An introduction August 28, 2013 ASU SoDA

  2. What is Git? • Version Control • Free and Open Source • Distributed != http://git-scm.com/downloads/logos, https://github.com/logos

  3. Without Version Control • Two programmers, one program • Changes collide • Harry’s changes are lost • This is no good… http://svnbook.red-bean.com/en/1.7/svn.basic.version-control-basics.html

  4. With Version Control Instead of overwriting, just combine the changes! Git(mostly) uses algorithms to merge files – with no input from the programmers!

  5. How to Git: • Files go in a repository • Usually, there is a central copy of the repository stored somewhere like GitHub • Users may clone the repository • Want to see the latest changes from the central copy? Fetch the repository. Pull to apply the changes to your working copy. • Want to send your changes to the central copy? Push your repository.

  6. Making Changes • When you’ve edited files, and are happy with the changes, stage the changes and committhem. • A commit is a file containing a list of changes. It’s labeled with a universally unique code to tell it apart from other commits. • Commits are relatively permanent. They can be undone, but it’s far easier to just double check before committing.

  7. What about those conflicts? • If you try to push or pull with an out-of-date copy, you will need to merge. • Merge combines the changes of two versions, usually automatically. • If there were unsolvable conflicts, Git will show you both versions in a text editor and let you decide. https://gist.github.com/zeroasterisk/4265044, http://git-scm.com/book/en/Git-Branching-Basic-Branching-and-Merging

  8. Branches • Git allows branching, multiple parallel copies of one program • Branches can be edited and committed to independently. Usually used to work on separate features or bugs • Unite two branches with merge. http://hades.name/blog/2010/01/22/git-your-friend-not-foe-vol-2-branches/

  9. Rebasing? • Rebasing reaches “back in time” and combines branches into one linear branch • Makes the Git history easier to read, but destroys information. BE CAREFUL http://hades.name/blog/2010/03/03/git-your-friend-not-foe-vol-4-rebasing/

  10. Other useful things • Commits must be tagged with messages explaining what they are doing • reset reverts all your working copy’s changes to the original state of the local repository • stash holds changes aside so they’re not committed immediately • diff lets you look at the changes made by each individual commit …and many, many more!

  11. Git Etiquette • Differs from place to place • For our repositories: • If the program compiles, builds, and runs, don’t commit changes that break that • Messages should be present (imperative) tense: First Line 50 Chars Max, Capitalized, is Subject Detailed explanation if necessary. Lines less than 72 chars longand written in normal English.

  12. More questions • Where do I get it? Where are GUIs for it? Where are SoDA’s repositories? What is GitHub? Something else formatted like a question?Will post more on the SoDA website.

More Related