In this tutorial i’ll write basic git command to create local git repository , staging changes, committing and push changes to remote git repository.
First, We have to know what is git?
Our next step would be setting up git in our local machine.
Simply download the installer exe file from the GitHub page, and run it. Git installer
Lets start working with git!
3. Adding changed file to commit
In our last step we created a file called helloGit.html and checked status whether it shows update or not. Now we will add this html file to stage state so that we can track further change happen to it.
How can we do that? Write this command on terminal
4. Now Committing new this change with a hints
Now we have to keep information about this change so that we differentiate it with previous changes. To do that, write this command in terminal.
Now lets check current git repository status using
and we will see this
5. Now we’ll push it to github.com
In this step we’ll push our updates to github.com.
To do that we have to create a repository in github.com.
Go to github.com and create a new repository name basicGitCommands
Now to connect basicGitCommand repository from our local machine , we have to set it as origin.To do that, we have to write this command.
After writing this command we will see this in terminal.
If you want to create repository from your local machine using command line, write this command in terminal
To do this, we have to write this command in terminal.
Yes!!! we have done it!
Here is the view of github.com/shuvrow/basicGitCommand.git
First, We have to know what is git?
Git is a open source distributed version control system.It is free and designed to handle everything from small to very large projects with speed and efficiency.
Now one question may arise on our mind. What is version control system?well, Version control is a system that records changes to a file or set of files over time so that you can recall specific versions later.
Now we know what is git and why we must use it. Our next step would be setting up git in our local machine.
Setup Git
*Linuxsudo apt-get install git
*WindowsSimply download the installer exe file from the GitHub page, and run it. Git installer
Lets start working with git!
- Empty Git Repository Setting Up
To initialize a empty git repository in local machine first you have to go the directory where you want to create repository. Then write this command in terminal.
git init
- Check current Status of repository
After initializing empty repository lets check current condition of repository.To do so, type this command in command line
git status
3. Adding changed file to commit
In our last step we created a file called helloGit.html and checked status whether it shows update or not. Now we will add this html file to stage state so that we can track further change happen to it.
How can we do that? Write this command on terminal
git add helloGit.html
Now check current status using previous command 4. Now Committing new this change with a hints
Now we have to keep information about this change so that we differentiate it with previous changes. To do that, write this command in terminal.
git commit -m "Creating helloGit.html page"
Now lets check current git repository status using
git status
and we will see this
5. Now we’ll push it to github.com
In this step we’ll push our updates to github.com.
To do that we have to create a repository in github.com.
Go to github.com and create a new repository name basicGitCommands
Now to connect basicGitCommand repository from our local machine , we have to set it as origin.To do that, we have to write this command.
git remote add origin https://github.com/shuvrow/basicGitCommand.git
Here shuvrow is my user name. Replace it with your user name. After writing this command we will see this in terminal.
If you want to create repository from your local machine using command line, write this command in terminal
curl -u 'shuvrow' https://api.github.com/user/repos -d '{"name":"basicGitCommand"}'
Now we have external git repository in github.com. So all we’ll going to push it in github.comTo do this, we have to write this command in terminal.
git push origin master
Yes!!! we have done it!
Here is the view of github.com/shuvrow/basicGitCommand.git
0 comments:
Post a Comment