Northeast PHP 2013

Lo que todo programador debe conocer sobre Git

Matthew Barlocker  · 
Git

Presentación

Vídeo

Transcripción

Extracto de la transcripción automática del vídeo realizada por YouTube.

I sure did this working hello no sure isn't should have tested this beforehand hello can you guys hear me is that on ok great thanks for the introduction due to the subject matter get essentials I'm going to be using a console fairly regularly I I

also because the number of questions that are likely to be asked will not be taking questions during the presentation I'd like to get through it all but with respect to Jen who presents in hereafter if you have any questions will take them quick if you

have any remaining questions after the time period you know I suggest write them down whatever and I'll take them in the back you're welcome I know right I already has the introduction if you forget my name you want to call me by name just ask yourself

who locked to the bar the bar lock or any night this one hello yeah yeah it does that it's a directional mic this it's falling back is any better still just as bad all right what if I just hold it for just a little while so right here how about now

good great so I I'm going to be using the terminal a lot here and that's how we're going to start instead of teaching a lot of theory let's go create a repository can anyone not see this if i start typing now anybody not see it great so creating

git repositories is extremely simple you can create one on the fly for whatever reason all you're going to do is create a new directory go into the directory and then run a command get an it tada you have a repository this is a fully functional git repository

it will committing branching cherry-picking pushing pulling it'll do everything that you want and it was that simple I frequently use git repositories for code competitions for you know just presentations or any other thing that I want to track and have

version files for it's very simple when i create the git repository it's going to do a couple things for me now mainly just 1 i'm sorry i take it back one thing it's going to create this dot get directory inside of the dot get is everything

that get requires to maintain your commits your branches tags maintain everything about that repository that only exists unlike subversion which has a dot svn directory in every subdirectory of that repository it only exists in get in the top level directory

if I want to commit now now that I have this repository we have to talk about staging first in get there is a concept of a staging area an area ready to be committed so I'm going to create a few files here just with a couple uuid is in them by creating

the file I've done nothing with respect to get I have not added them to the staging area I have not committed them they're just files that exist in the directory if I show the files there they are if I cat the contents of the files there they are nothing

special about them yet there's a command and get called git status this is going to show me a couple things it will show me this the change is ready to be committed the staged area it will shame show me changed files ones that are being tracked currently

they've been committed before they're not new files and they've been modified since the last commit in addition it will also show me the untracked files they have never been committed before currently that's the only kind we have as you watch

this next to the part you will notice parts files in each of the three sections to add something to the staging area we're going to use ad get ad and then give it the name of the file or files if I do another get status we're going to see that a and

C that coloring is bad can anyone not see the coloring great I one person I think we can not change dope maybe maybe one more it's gradual there we go yeah way better we can see a and C are now ready to be committed they are in this staged area if and

when I do a commit a and C will be committed B&D will not be committed they will remain untracked files so here i go every git commit requires a message can be whatever you like I commit it now if I do another git status we're going to see that a and

C are gone from the status altogether there are no changes they're not new files therefore they're removed they're not displayed on git status B&D however remain untracked let's go in and change a git status will now show it's a modified

file it has been changed I'm sorry it has been committed before and it has been changed since I'm going to get add B and a this should give us two files in the staged area one is a modified file another one is a new file and then d remains untracked

I can commit again and now d is the loan file that has not been committed we're going to just commit him real quick now my git repository the working directory is entirely free from changes it is clean a couple things to note git repos can be created anywhere

I strongly urge you anytime you want to version anything use a git repo you don't have to share them you don't have to start it on github you don't have to have a company repository to do it you just make one it's good you can commit another

thing only the staging area is committed we talked about that and then the final thing that I failed to show you until this point is that every commit we do has an md5 hash that is generated by get to show you those there they are this commit if i can find

the mouse oh there it is when I committed d I got that commit ID it was assigned I can refer to that commit by this substring of the md5 hash or by the entire md5 hash every commit that you do has a commit ID we will refer to these in the future for now just

know that they exist and they are unique within a git repository the commit graph as of right now looks something like this we started a repository we had initial an initial commit and then we made a set of subsequent commits after that they were all linear

there is no branching no merging it's very simple so far you can see every commit has a commit ID now let's take a look at what just happened from gets perspective there's a command called get log very similar to subversion log if you're familiar

svn log it's just going to show me every commit most recent first that has happened on the repository on my current branch on the working directory gives me the commit ID who did it when they did it and the message I can also view what files were changed

[ ... ]

Nota: se han omitido las otras 3.128 palabras de la transcripción completa para cumplir con las normas de «uso razonable» de YouTube.