Академический Документы
Профессиональный Документы
Культура Документы
HelloWorldGitHubGuides
VideoGuides
GitHubHelp
GitHub.com
HelloWorld
10minuteread
TheHelloWorldprojectisatimehonoredtraditionincomputerprogramming.It
isasimpleexercisethatgetsyoustartedwhenlearningsomethingnew.Lets
getstartedwithGitHub!
GitHubisaplatformforhostingandcollaboratingonprojects.Youdonthaveto
worryaboutlosingdataonyourharddriveormanagingaprojectacrossmultiple
computerssyncfromanywhere.Mostimportantly,GitHubisacollaborative
andasynchronousworkflowforbuildingsoftwarebetter,together.
ThisguidewalksyouthroughtheGitHubEssentials:Repositories,Branches,
Commits,IssuesandPullRequests.
Withtheseskills,youllgofar.Andwiththis helloworld repositoryyoull
haveaplacetostoreideas(akafuturerepositories,likejlord/helloworld),
resourcesorothergeneralnotes,evendiscussthingswithothers(like
holman/feedback).
Install&CodeFreeZone
WeregoingtocompletethetasksinthistutorialusingGitHub.com,soyoudont
havetoknowthecommandlineoreveninstallGit(whichisthechangetracking
softwareGitHubisbuilton).Youdontevenneedtoknowhowtocode.Youwill,
https://guides.github.com/activities/helloworld/
1/11
06/08/2015
HelloWorldGitHubGuides
however,needaGitHubaccount,sosignupifyoudonthaveone!
Tip:Openthisguideinaseparatebrowserwindow(ortab)soyoucansee
itwhileyoucompletethestepsinthetutorial.
CreateaRepository
ArepositoryisthebasicunitofGitHub,mostcommonlyasingleproject.
Repositoriescancontainfoldersandfiles,includingimagesanythingyour
projectneeds.BecausewerecommendincludingaREADME,orafile
describingtheproject,ineveryrepository,GitHubmakesiteasytoaddoneat
thesametimeyoucreateyournewrepository.Italsooffersothercommon
optionssuchasalicensefile,butwecanskipthatfornow.
Tocreateanewrepository
1. Clicktheiconnexttoyourusername,topright.
2. Nameyourrepository helloworld .
3. Writeashortdescription.
4. SelectInitializethisrepositorywithaREADME.
Intro
https://guides.github.com/activities/helloworld/
2/11
06/08/2015
HelloWorldGitHubGuides
Createa
Repository
Openan
Issue
Createa
Branch
Makea
Commit
Opena
Pull
Request
MergePull
Request
ClickCreaterepository.Boom,repository!
OpenanIssue
AnIssueisanoteonarepositoryaboutsomethingthatneedsattention.Itcould
beabug,afeaturerequest,aquestionorlotsofotherthings.OnGitHubyou
canlabel,searchandassignIssues,makingmanaginganactiveprojecteasier.
Youvegotarepositorynow,butitsprettybare.ItcoulduseaREADMEwith
moreinformationinitsothatpeopleknowwhatisgoingon.OpenanIssue!
OpenanIssueforREADMEedits
1. ClicktheIssuestabfromthesidebar.
2. ClickNewIssue.
3. GiveyourIssueatitleanddescription.
https://guides.github.com/activities/helloworld/
3/11
06/08/2015
HelloWorldGitHubGuides
ClickSubmitnewIssuewhenyouredone.Nowthisissuehasapermanent
home(URL)thatyoucanreferenceevenafteritisclosed.
Next,worktowardseditingyourREADMEandclosingthisissue.
CreateaBranch
Branchingisthewaytoworkondifferentpartsofarepositoryatonetime.
Whenyoucreatearepository,bydefaultithasonebranchwiththename
master .Youcouldkeepworkingonthisbranchandhaveonlyone,thatsfine.
Butifyouhaveanotherfeatureorideayouwanttoworkon,youcancreate
anotherbranch,startingfrom master ,sothatyoucanleave master inits
workingstate.
Whenyoucreateabranch,youremakingacopyoftheoriginalbranchasitwas
atthatpointintime(likeaphotosnapshot).Iftheoriginalbranchchangeswhile
youreworkingonyournewbranch,noworries,youcanalwayspullinthose
updates.
https://guides.github.com/activities/helloworld/
4/11
06/08/2015
HelloWorldGitHubGuides
Youmayhave,atsomepointinyourlife,saveddifferentversionsofafilelike,
story.txt,storyjoeedit.txt,storysueedit.txt.Branchesaccomplishthesame
goalsbutareeasiertomanageonGitHubrepositories.
AtGitHub,ourdevelopers,writers,anddesignersusebranchesforkeepingbug
fixesandfeatureworkseparatefromour master (production)branch.Whena
featureorfixisready,thebranchismergedinto master .
Tocreateanewbranch
1. Gotoyournewrepository helloworld .
2. Clickthedropdownatthetopofthefilelistthatsaysbranch:master.
3. Typeabranchname, readmeedits ,intothenewbranchtextbox.
4. SelecttheblueCreatebranchboxorhitEnteronyourkeyboard.
https://guides.github.com/activities/helloworld/
5/11
06/08/2015
HelloWorldGitHubGuides
Makeacommit
OnGitHub,savedchangesarecalledcommits.Commitsareprettyglorious,
becauseabunchofthemtogetherreadlikethehistoryofyourproject.
Eachcommithasanassociatedcommitmessage,whichisadescription
explainingwhyaparticularchangewasmade.Thankstothesemessages,you
andotherscanreadthroughcommitsandunderstandwhatyouvedoneand
why.
Youshouldstillbeonthecodeviewforyour readmeedits branch,now
makesomechanges!
Tocommitchanges
https://guides.github.com/activities/helloworld/
6/11
06/08/2015
HelloWorldGitHubGuides
1. ClicktheREADMEfile.
2. Clickthepenciliconintheupperrightcornerofthefileviewtoedit.
3. Intheeditor,writesometext,tellabitaboutyourself.
4. Writeacommitmessagethatdescribesyourchanges.
ClickCommitchanges.NowthesechangeshavebeenmadetotheREADME
fileonyour readmeedits branchandnowthisbranchcontainsdifferent
contentandcommitsthan master (asitshould!).
OpenaPullRequest
PullRequestsaretheheartofcollaborationonGitHub.Whenyoumakeapull
request,youreproposingyourchangesandrequestingthatsomeonepullin
yourcontributionakamergethemintotheirbranch.GitHubsPullRequest
featureallowsyoutocomparethecontentontwobranches.Thechanges,
additionsandsubtractions,areshowningreenandredandcalleddiffs
(differences).
https://guides.github.com/activities/helloworld/
7/11
06/08/2015
HelloWorldGitHubGuides
Assoonasyoumakeachange,youcanopenaPullRequest.PeopleusePull
Requeststostartadiscussionaboutcommits(codereview)evenbeforethe
codeisfinished.Thiswayyoucangetfeedbackasyougoorhelpwhenyoure
stuck.
ByusingGitHubs@mentionsysteminyourPullRequestmessage,youcanask
forfeedbackfromspecificpeopleorteams,whethertheyredownthehallor10
timezonesaway.
Youcanevenopen,asweredoinghere,aPullRequestinyourownrepository
andmergeityourself.Itsagreatwaytolearntoprocessbeforeworkingon
largerprojects.
CreateaPullRequestforchangestotheREADME
Clickontheimageforalargerversion
Step
Screenshot
ClickthePullRequesticonon
thesidebar,thenfromthePull
Requestpage,clickthegreenNew
pullrequestbutton.
Selectthebranchyoumade,
readmeedits ,tocomparewith
master (theoriginal).
https://guides.github.com/activities/helloworld/
8/11
06/08/2015
HelloWorldGitHubGuides
Lookoveryourchangesinthediffs
ontheComparepage,makesure
theyrewhatyouwanttosubmit.
Whenyouresatisfiedthatthese
arethechangesyouwantto
submit,clickthebiggreenCreate
PullRequestbutton.
Giveyourpullrequestatitleand
sinceitrelatesdirectlytoanopen
issue,includefixes#andthe
issuenumberinthetitle.Writea
briefdescriptionofyourchanges.
Whenyouredonewithyourmessage,clickCreatepullrequest!
Tip:Youcanuseemojianddraganddropimagesandgifsontocomments
andPullRequests.
https://guides.github.com/activities/helloworld/
9/11
06/08/2015
HelloWorldGitHubGuides
MergeyourPullRequest
Itstimetobringyourchangestogethermergeyour readmeedits branch
intothe master branch.
1. Clickthegreenbuttontomergethechangesinto master .
2. ClickConfirmmerge.
3. Goaheadanddeletethebranch,sinceitschangeshavebeenincorporated,
withtheDeletebranchbuttoninthepurplebox.
Ifyourevisittheissueyouopened,itsnowclosed!Becauseyouincludedfixes
#1inyourPullRequesttitle,GitHubtookcareofclosingthatissuewhenthe
PullRequestwasmerged!
Celebrate!
YouvelearnedtomakeapullrequestonGitHub!
Foryourhumblebrag,herearethethingsyouaccomplishedinthistutorial:
createdarepository,branch,issue,andpullrequest,thenmergedapull
request!Showoffyournewcontributionsquares!
Ifyouwanttolearnmoreaboutthepowerofpullrequests,werecommend
readingtheGitHubFlowGuide.YoumightalsovisitGitHubExploreandget
involvedinanOpenSourceproject
https://guides.github.com/activities/helloworld/
10/11
06/08/2015
HelloWorldGitHubGuides
Tip:CheckoutourotherGuidesandYouTubeChannelformoreGitHub
howtos.
LastupdatedMay,2014
GitHubisthebestwaytobuildandshipsoftware.
Powerfulcollaboration,codereview,andcodemanagementforopensourceandprivate
projects.
https://guides.github.com/activities/helloworld/
11/11