In this tutorial you will learn to upload new project in git, cloning the existing project from git and committing the changes to the existing project.
Uploading new project first time on your git
Go to your project folder and type the below command in the terminal, this command just initializes your git access to the project folder.
git init .
Now to access your repository, you have to copy your repository http url, then type the below command in terminal.
git remote add origin "paste the http url of the repository"
Now you are ready to upload your project to the repository, the below command will start to add the project.
git add .
For every upload you have to give a message to the project, type the below command in terminal
git commit -m “tell the message”
The below command will upload your project to the branch in your repository
git push -u origin "branch name"
To clone your project, from the existing git repository
Before cloning your project, Confirm the last commit from the graph in your repository, Then use the below command to clone the project.
git clone “ paste the http code of the project” --branch “branch name”
To check the difference after working on the cloned project
To know the files you have changed, use the below command in the terminal. Make sure before using this command you have to be in your project folder.
Next use the below command to see the difference in each line of the files
To commit your project, to the existing git repository
Before commit the changes use the below command to add the project. Note: “add .” the last dot is important, don’t miss it.
git add .
To give a message for your commit use the below command
git commit -m "type your changes in single line"
Finally use the below command to push your local changes to Git
git push origin "branch name"