Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
Let's now go very quickly
over the absolutely fundamentals of Git,
and this is by no means a complete overview of Git.
All I want to do here is to get you started
with Git as quick as possible
so that we can then deploy our project to Heroku.
And as I mentioned in the last video,
I will start using Git in the command line now, all right?
And actually I'm using the terminal
right here in VS Code again.
So let's now quit the current process here, okay?
And now here in our local project folder,
create a new repository,
and we do that by writing git init, okay?
Hit Enter and that's it.
So we just initialized an empty Git repository,
or we can also call it just a repo.
So that's a bit easier to say.
So, again, in order to create a new repository,
or repo, for your project,
you need to navigate to that project folder,
which here in VS Code happens kind of automatically.
So we're automatically right here in the Home folder
and then in there you write git init,
and so that then spins up this new repository.
And here in my command line, you can actually
see this yellow part now here of the prompt,
and probably on your terminal you won't have that,
and it doesn't really matter.
So all that means here is that right now
we have a repository with a branch called master, okay?
And a bit more about the master branch later.
Anyway, before we now do anything else,
let's create a special file called gitignore,
and in there we will add all the files
that we do not want to have in our repository.
So that's kind of a configuration file
just like this prettier or eslint configurations.
So I can create a new one here.
The output here.
So .gitignore, like this, all right?
And VS Code, actually once more,
already recognized this file
and adds this nice symbol to it.
And the first folder that we actually want
to completely ignore is the node_modules folder,
so we write node_modules, all right?
Give it a second and then also want
to ignore the configuration file.
So all the environment variables file.
And so we can say all the .env files, okay?
So the node_modules folder, we do really not want
in our repository because that's simply not necessary.
So, for example, if we're gonna upload our repository
to GitHub, we then don't want to upload all these
tens of thousands of files because once we download
the project from GitHub somewhere else,
we can then easily get the node_modules folder back
by writing npm install, right?
And so keep in mind that Git is all about sharing as well,
not just about saving your code with snapshots over time,
but it's really also about all this collaboration.
Now here in VS Code on this left side,
we actually have this integration with Git.
So if you click here, you'll see all
of the files that are marked as modified.
Well, right now we don't see any here,
so let's just reload, but they still don't show up here,
and I think that's because we initially
had too many files in node_modules,
and so now VS Code is a bit confused with that.
Let's check our Problems.
No, it doesn't have anything to do with that, all right?
But, anyway, that doesn't really matter, okay?
What matters is that we can now actually also see
all these modified files by writing git status.
Like this, okay?
And so here are now all the files and folders
which are basically not yet committed to our repository.
So Git is all about commit, and so let's now learn
how we can commit files to the repository,
and that's kind of a two-step process.
First we need to add the files to a so-called staging area,
and only after they are in this area,
we can then commit all files
that are there to a new commit, all right?
So let's do that.
So git add, and then if I want to add all the files,
I can simply write -A, am I right?
So that's taking a bit of time now
because there are so many files,
and so now if I write git status again,
let's see, now all of them are actually green.
So here you can see all the tons of these files
which are now gonna be added to our git commit, okay?
Now, actually, I don't want these cached files
in this cache folder,
so let's quickly get rid of this folder.
Okay, so I hope they are gone now actually also from this.
So let's hope they are gone from here as well now.
And delete, they are now deleted,
so they're no longer here,
but let's see if all the others are still here.
Okay, so you see that these are not staged for commit,
but all of these other files,
they will now be committed to the repository.
Now probably it sounds a bit confusing to you
why we first have to add these files to the staging area,
and only then they can be committed.
And the quick reason for that is that you might want
to add different files for different commits, okay?
So imagine you change 10 files but only want
to commit five of them to a certain commit.
And so by staging, you can do that.
But we just want to keep it very simple here,
and so we simply add all the files
to this staging area and then commit all of them.
And, actually, let's do it again
because now I deleted all these files.
So let's do git add -A again, okay?
And so now we're ready to commit the files
by writing git commit -m,
and then we specify a commit message.
And this message should really be descriptive
of the changes that you did.
Now usually the first commit is called Initial commit,
and so let's do that here as well.
So Initial commit, hit Return, and that's it.
So with this commit we saved
all the modifications to the repository,
and, again, a commit is like a snapshot
of all the code at a certain point in time, all right?
And kind of the philosophy is to create one new commit
each time that you do significant changes to your code base.
So the concept of commit is really the central point of Git.
So everything revolves around committing, okay?
And now let's just try to modify some file here.
So we can close all of these.
Now let's now open up app.js here, all right?
Close this a bit more.
And here let's just say Start express app.
Give it a save, and you see it right away
in VS Code how we get this green line.
And so that means that there
was something new inserted at this point.
You can now also click on it
and see basically how it looked like before,
and you can also, right here, move back in time.
So revert the change.
And the same thing when you delete something.
So let's just delete this line of code.
And so here you see that before
basically there was something.
So, again, you can click that
and basically see what there was before.
You can move back in time,
and so let's do that in order to bring it back.
Now let's quickly try to load it here,
but for some reason the changed files do not appear here.
So, ideally, now app.js would be here in this list
because that is the file that I just edited, okay?
But, again, anyway, that's not really important.
It should also show up here in this file tree
with a different color as soon as I edited it, okay?
Now if we say git status again,
then you will see here modified: app.js, okay?
So that's the only output that we have here,
and you also see that the changed
are not yet staged for commit, okay?
And so now, again, let's add all of them.
So git add and then -A,
or we could also just add this single file to the add.
So app.js, all right?
Let's try git status again, and so now it is green.
And so that means that the changes will be committed
as soon as we do a new commit.
So let's do that, git commit -m.
For the message, Added a comment,
and that's it.
So, you see, the message added the comment.
One file has changed and there was one insertion.
So that's this line here.
And so now that green bar that we had here is gone,
and so that means that everything is now clean again.
Now you also see that this master here,
you also see it here,
and that means that we are on the master branch.
So branches are another very important concept in Git,
but I will not really go into that at this point.
For now we will always just work in the master branch.
Great, so now you have a local repository
with all your code committed to it.
And so in the next video, let's actually
push this branch onto a remote branch on GitHub.
So basically host it on the GitHub account
that we just created before.
So I hope to see you there soon.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.