filmov
tv
GIT Tutorial for Beginners #5 | Create your First Git Project | Use Git Basic Commands | git init

Показать описание
In Part-5 of Git Tutorial, we will start using Git for our first sample Git Project. We will try to understand the basic commands of Git with this project. In upcoming videos, we will use Git for our live Laravel projects.
Create one folder testgit in which we will create below files:-
We will write some dummy content in the above files.
If you are on Windows OS, then go inside testgit folder and right-click to choose "Git Bash Here".
After the Git Bash terminal open, try the below commands:-
git status
The "git status" command is used to understand what stage the files in a repository are at.
The output of this command not only tells you the stage of the files in your repository but also gives you some handy tips on what to do next.
Like if we will run this command now without initializing our project, It will give us a message that is “fatal: not a git repository (or any of the parent directories): .git”.
It is a message that says these files are not considered as a git repository. So we need to initialize our project first.
git init
"git init" initialize our project folder as a Git Repository. This command creates a Git repository skeleton(.git) which contains all necessary repository files in the current working directory.
Like we are going to run the "git init" command for our project folder testgit to initialize it as a Git Repository.
Now if we run the "git status" command again then we will get the files that are present in the folder. Also, it says these files are not tracked.
git add
The "git add" command is used to add files to the Staging Area of the Git.
Like to add all the files for our project folder testgit inside Git Repository we will type “git add --a”, which will add all these files to the staging area.
We can also add some particular files to Git Repository by specifying the name of the file with the "git add" command.
git commit
The "git commit" command is used to save your changes to the local repository. It captures a snapshot of the project's currently staged changes. We can also run this command with the -m option to record a short message that explains what we did and why.
Like we can run the "git commit -m 'Initial Commit" command to finalize our changes to the project.
Other Popular Stack Developers Series that can help you:-
Follow Stack Developers on Social Media to get updates and resolve your queries
#Git #GitTutorial #GitBasics