referredgit
git 使用 时间:2021-02-24 阅读:(
24)
GitandGithubKatieOsterriedC2SMCOSMOGeneralMeeting2016Outline1Introductiontogit2Basicgitfeatures3Workingwithremotes4Githubwebinterface5UsefulgitresourcesOutline1Introductiontogit2Basicgitfeatures3Workingwithremotes4Githubwebinterface5UsefulgitresourcesWhatisgitVersioncontrolsystem(likeSVN)Toolfortrackingofchangesinlesinorderto:RecordreasonsforchangesComparewithandincorporateversionsfromothersourcesHavemultiplepeopledevelopingthesamecodeMaintainseveralparallelversionsofthesamecodeinasystematicwayDesignedforcollaborative,opensourceworkowsSource:https://git-scm.
com/downloads/logosStatusoftheC2SMgitmigrationC2SMhostedCOSMOandrelatedcodesweresuccessfullymigratedfromSVNtogitinDecember2015AllthecodedevelopmenthistorywasretainedduringthemigrationCodeisnowhostedongithub.
comin42separatecoderepositoriesFieldextraandExtparocialversionsnowhostedonGithubGitTerminology1.
repository:thelocationofthesavedcodeanditshistory2.
branch:anindependentlineofdevelopment3.
master:thedefaultbranch4.
commit:asnapshotofyourprojectatacertaintime5.
tag:afrozenreferencetoaparticularcommit6.
HEAD:thecurrentlycheckedoutcommit7.
index/stagingarea:areabetweenworkingdirectoryandrepository8.
remote:arepositorylinkedtothelocalrepositoryImportantdierencesfromSVNGitisadistributedversioncontrolsystemEveryuserhasthewholerepositoryUserscansavechangestothelocalrepositorywithoutanetworkRepositoriescanbelocatedanywhereandlinkedtogethereasilyWorkowforagroupmustbeclearlydenedSource:http://www.
codemag.
com/Article/1105101ImportantdierencesfromSVNGitusesastrictdenitionofbranchesandtagsBranchesandtagsarenotassociatedwithdierentdirectories(likeSVN)BranchesandtagsaresimplypointerstoacertaincommitThetrunkequivalentiscalled"master"andisnodierentfromanyotherbranchImportantdierencesfromSVNGitusesdierentcommitIDsLinearrevisionnumbersdon'tworkEachcommithasauniqueidentiergeneratedbyanalgorithmSeriesof40charactersandnumbersCommitscanbegenerallyreferredtobytherst6-8charactersoftheIDExample:commitf3abe64fc121b75f3f0566c73f2f1a4e8fd68eCanbereferredtoas:f3abe64ImportantdierencesfromSVNGitusesastagingareaAdditionallayerbetweenworkingdirectoryandrepositoryStoresinformationaboutwhatwillgointhenextcommitAllowsyoutogroupcommitslogicallySource:https://git-scm.
com/book/en/v1/Getting-Started-Git-BasicsOutline1Introductiontogit2Basicgitfeatures3Workingwithremotes4Githubwebinterface5UsefulgitresourcesLocalgitworkow1.
Startorcopyagitrepositorylocally(gitinit,gitclone)2.
Makeafeaturebranchfordeveloping(gitbranch,gitcheckout)3.
Makesomecodechanges4.
Savethecodechangestothestagingarea(gitadd)5.
Savethecodechangestotherepository(gitcommit)6.
Mergethechangesfromthefeaturebranchtothemaster(gitmerge)HowtostartarepositoryCommandstostartworkingwithgit:gitcongSetcongurationvariablesforgitUsage:gitconguser.
name"YourName"Usage:gitcong--globaluser.
email"youremail@email.
com"gitinitCreatesanemptygitrepositoryCreatesbydefaultthemasterbranchCreatesthe.
gitfolderandcontentsUsage:gitinitgitcloneCopiesanexistinggitrepositoryCreatesandnavigatestothecurrentbranchofthecopiedrepositoryLinkstheoriginalrepositoryasaremoteUsage:gitclone/path_to_original/path_to_copyHowtomakecommitsCommandsforsavingcodechanges:gitaddSavescodechangestothestagingareaCanaddallorsomeofthecurrentcodechangesCanbeperformedmultipletimesbeforeacommitUsage:gitadd/path_to_legitcommitSavesthechangesinthestagingareatotherepositoryCreatesauniquecommitIDSavesalogmessagefromtheuserUsage:gitcommitHowtoexaminearepositoryCommandsforgettinginformationaboutarepository:gitlogDisplaysthelogofallthecommitsCanbecustomizedthroughcommandlineoptionsUsage:gitloggitstatusShowsthestatusoftheworkingcopyStateswhichleshavebeenplacedinthestagingareaShowswhichleshavebeenmodiedbutnotplacedinthestagingareaUsage:gitstatusgitdiShowsthechangesbetweentwoversionsofthecodeManyoptionsforcustomizationUsage:gitdiHowtoexaminearepositoryCommandsforlookingatpreviouscommits:gitcheckout(oldcommit)DisplaystheworkingcopyasitwaswhenthecommitwasmadeShouldbeusedforlookingatoldcommits,notdevelopmentAnythingcommittedwillNOTbesavedtoacurrentbranchUsage:gitcheckoutcommitIDgitcheckout(singlele)UpdatestheleinthecurrentworkingcopyUsedforrecoveringoldversionsoflesAnythingcommittedWILLbesavedtothecurrentbranchUsage:gitcheckoutcommitID/path_to_leHowtocreateandswitchtoabranchCommandsforworkingwithbranches:gitbranchListscurrentbranchesorcreatesanewoneCreatesbranchfromcurrentHEADDoesnotautomaticallyswitchtonewbranchUsage:gitbranchbranch_namegitcheckout(branch)ChangesthelesintheworkingcopytothebranchLocalchangesarepreservedUsage:gitcheckoutbranch_nameMergingwithoutcommitsFast-forwardmergeisthedefaultbehaviorgitmergeCombinesthetargetbranchwiththecurrentbranchDoesnotcreateacommitunlessithasto(oryoutellitto)CalledfromthebranchyouwanttomergeintoUsage:gitmergebranch_nameMergingwithoutcommitsFast-forwardmergeisthedefaultbehaviorgitmergeCombinesthetargetbranchwiththecurrentbranchDoesnotcreateacommitunlessithasto(oryoutellitto)CalledfromthebranchyouwanttomergeintoUsage:gitmergebranch_nameMergingwithoutcommitsFast-forwardmergeisthedefaultbehaviorgitmergeCombinesthetargetbranchwiththecurrentbranchDoesnotcreateacommitunlessithasto(oryoutellitto)CalledfromthebranchyouwanttomergeintoUsage:gitmergebranch_nameMergingwithcommitsConictingmergesalsooccurgitmergeAcommitismadeforaconictingmergeConictsmustberesolvedbeforemergeiscompletedRemoveconictmarkersfromconictedlesgitaddconictedlegitcommitconictedleUsage:gitmergebranch_nameOutline1Introductiontogit2Basicgitfeatures3Workingwithremotes4Githubwebinterface5UsefulgitresourcesgitusesremotesEachlocalrepositorycanconnecttomultipleremoterepositoriesRemotescanbelocaloracrossanetworkRemotescanberead-onlyorread-writeaccessWorkowmustbeclearlydenedfromthebeginningSource:http://thepilcrow.
net/explaining-basic-concepts-git-and-githubHowtolinktoaremoteCommandsforconnectingtoandexaminingremotes:gitremoteListsalloftheremoterepositoriesUsing-voptionlistsalltheremoterepositoriesandtheirpathsUsage:gitremote(-v)gitremoteaddConnectsanexistingrepositorywitharemoteoneUsage:gitremoteaddremote_name/path_to_remotegitremoteshowDisplaysdetailedinformationabouttheselectedremoteListsbranchesinremoterepositoryandhowtheyarelinkedtothelocalrepositoryUsage:gitremoteshowremote_nameHowtogetcodefromaremoteCommandsforexchangingcodewithremotes:gitfetchUpdatesdatainremotebranchesoflocalrepositoryCantheninspectand/ormergethisdataintolocalbranchesUsage:gitfetchremote_namegitpullUpdatesdatainremotebranchesoflocalrepositoryAutomaticallymergesremotedataintolocalbranchesgitpull=gitfetch+gitmergeUsage:gitpullremote_namegitpushSendschangesintoremoterepositoryMustdoagitfetchandgitmergerst,tomakesurethatthelocalbranchisuptodatewiththeremoteUsage:gitpushremote_namebranch_nameRemotebranchesGitusesremotebranchestotrackchangestoremoterepositoriesBranchesinthelocalrepositorycontainingdatafromremotesCanbedisplayedusinggitbranch-aCreatedduringgitcloneautomaticallyTaketheformremote_name/branch_nameSource:https://git-scm.
com/book/en/v2/Git-Branching-Remote-BranchesDemonstrationOutline1Introductiontogit2Basicgitfeatures3Workingwithremotes4Githubwebinterface5UsefulgitresourcesGithubWebinterfaceforhostingremotesWebserviceshostremoterepositories(canbepublicorprivate)ProvideinterfacesforvisualizingrepositoriesSupportcollaborationandgoodcodingpracticesCanalsoeditlesandmakecommitsthereSource:https://github.
com/logosPermissionsTherearethreedierentlevelsofpermissionsforaccessingthecoderepositoriesonGithub:1.
OwnersTwoorthreepeopleonlyHavecompletecontroloverthecoderepositoriesCancreateordeleterepositories,addusers,andwritetoeveryrepository2.
AdminsOneortwopeopleforeachrepository(admin-codename)HavewriteandreadaccesstotheirassignedrepositoryAddnewversionsofcodeandincorporatenewfeaturesandbugxes3.
UsersEveryonewhoisnotanowneroradminHavereadaccesstoallofthecentralrepositoriesPullRequestsPullrequestsareusedtoreviewcodebeforemergingnewfeaturesintothemaincodebaseRequestforchangesfromafeaturebranchtobeputintocentralrepositoryGeneratedthroughwebinterface(notcommandline)CanbemergedusingwebinterfaceifnomergeconictsexistWebinterfacefacilitatesreviewofandcommentingoncodebeforepullrequestisgrantedSource:https://www.
atlassian.
com/zh/git/workows#!
pull-requestIssuetrackingWeusetheissuetrackeronGithubasanorganizationaltoolIssuetrackersallowyoutokeeptrackofknownbugs,desiredfeatures,andotherto-doitemsforthecodeIssuescanbeassignedtoaspecicpersonOtheruserscansubscribetobenotiedwhenknownissuesareresolvedIssuescanbecolor-codedandlabeledsotheyareeasilylteredAnybodywithaccesstotherepositorycancommentonissuesCosmo-prereleaserepositoryworkow1.
Copytherepositorytoyourlocalmachine(gitclone)2.
Makeafeaturebranchforyourowndevelopment(gitbranch)3.
MakechangestoyourlocalrepositoryfollowingthelocalGitworkow4.
Savethechangestothecosmo-prereleaserepository(gitpush)5.
Makeapullrequesttostartthecodereviewprocess(Generatepullrequestusingwebinterface)6.
TestthebranchusingtheautomatedtestingprogramJenkins('launchjenkins'commandinpullrequestcomments)7.
Oncetestshavepassedandcodehasbeenreviewed,thecodeownerwillmergethepullrequest(Mergepullrequestusingwebinterface)DemonstrationOutline1Introductiontogit2Basicgitfeatures3Workingwithremotes4Githubwebinterface5UsefulgitresourcesBestPracticesSomebestpracticeswhenworkingwithGit:ChooseaworkowatthebeginningofaprojectandstickwithitWherewilldevelopmentofnewfeaturesoccur(branches,forks)WhatisthenamingconventionforbranchesandforksWhoisresponsibleforthecentralrepositoryHowwillthecodereview/pullrequestprocessworkReviewcodeinstagingareabeforecommittingitCommitsmalllogicalchangesMakeusefulcommitmessagesthatcanbeunderstoodbyanyoneFirstlineofmessageshouldbeaonelinesummaryDetailsofcommitfollowthesummaryKeeprepositoryclean-removeunused/nishedbranchesGitResourcesgithelpDisplaysthemanpageforthegivencommandDisplaysgeneralgitinformationwhennocommandnameisgivenUsage:githelp(command_name)http://git-scm.
com/ComprehensivedescriptionofGitcommandsandconceptshttp://gitref.
org/Quickreferenceguideforcommandshttps://training.
github.
com/kit/downloads/github-git-cheat-sheet.
pdfCheatsheetwithGitcommandsGraphicalgittoolsBuilt-ingitgraphicaltoolsgitkDisplayschangesinarepository;informationaboutcommitsCannotbeusedtomakecommitsgit-guiUsedformakingchangestoarepositoryCancommit,branch,merge,andinteractwithremotesDoesnotshowcodehistoryThirdpartygitgraphicaltoolsSourceTreeCancommit,branch,merge,andinteractwithremotesCanviewhistoryandcommitsOnlyforOS:MacandWindowsSmartGitCancommit,branch,merge,andinteractwithremotesCanviewhistoryandcommitsOS:Mac,Linux,andWindowshttp://www.
syntevo.
com/smartgit/
如何低价香港服务器购买?想要做一个个人博客,想用香港服务器,避免繁琐备案,性能不需要多高,只是记录一些日常而已,也没啥视频之类的东西,想问问各位大佬有没有低价的香港服务器推荐?香港距大陆近,相比美国服务器最大的优势在于延迟低,ping值低,但是带宽紧张,普遍都是1M,一般戏称其为“毛细血管”。同时价格普遍高,优质稳定的一般价格不菲。大厂云梯队阿里云、腾讯云两家都有香港服务器,要注意的是尽量不要选择...
UCloud优刻得近日针对全球大促活动进行了一次改版,这次改版更加优惠了,要比之前的优惠价格还要低一些,并且新增了1核心1G内存的快杰云服务器,2元/首年,47元/年,这个价格应该是目前市面上最低最便宜的云服务器产品了,有需要国内外便宜VPS云服务器的朋友可以关注一下。UCloud好不好,UCloud服务器怎么样?UCloud服务器值不值得购买UCloud是优刻得科技股份有限公司旗下拥有的云计算服...
数脉科技怎么样?昨天看到数脉科技发布了7月优惠,如果你想购买香港服务器,可以看看他家的产品,性价比还是非常高的。数脉科技对香港自营机房的香港服务器进行超低价促销,可选择10M、30M的优质bgp网络。目前商家有优质BGP、CN2、阿里云线路,国内用户用来做站非常不错,目前E3/16GB阿里云CN2线路的套餐有一个立减400元的优惠,有需要的朋友可以看看。点击进入:数脉科技商家官方网站香港特价阿里云...
git 使用为你推荐
google地球打不开谷歌地球为啥打不开了?急!!!快速美白好方法脸部快速美白有什么好方法啊中国论坛大全中国十大网站是?微信如何建群微信怎么建群?百度手写百度手写显示硬盘人上海人说“硬盘”是什么梗神雕侠侣礼包大全神雕侠侣手游华山论剑礼包有什么 怎么领取xv播放器下载求手机可以看xv格式的视频播放器bt封杀BT下载可以封杀迅雷吗?什么原理?能破吗?商标注册查询官网全国商标注册查询在哪里查呀?
景安vps 什么是二级域名 wavecom idc测评网 patcha 智能骨干网 腾讯云分析 tna官网 linux使用教程 卡巴斯基免费试用版 申请免费空间和域名 cloudlink 跟踪路由命令 下载速度测试 电信网络测速器 独立主机 cdn网站加速 万网主机 测试网速命令 存储服务器 更多