If you are newly started git then follow these steps :
Let's suppose your git repository url is https://github.com/absuser/repo.git
And you want to push your project on this repository with branch name 'testbranch' and your code on your machine at '/home/ubuntu/Documents/code'
Now let's start :
press ctrl+alt+T to open your terminal.
$ cd /home/orange/Documents/code
$ git init
Create branch on local
$ git checkout -b testbranch
Add remote repository
$ git remote add origin https://github.com/absuser/repo.git
Verify added remote
$ git remote -v
$ git config --global user.email "[email protected]"
$ git config --global user.name "username"
$ git add .
$ git commit -m "my first comit "
$ git push origin testbranch
Now your code pushed on git now .
In case if someone else also committed the code on same branch and you want to merge all the changes with your code on your local machine and push to git then follow these steps :
First you have to stagged your all updated files .
$ git add .
$ git pull origin testbranch
If any conflict occurs then resolved that and do following steps
$ git add .
otherwise go ahead
$ git commit -m 'merged changes from master'
$ git push origin testbranch