The steps below are applied when there is some files, in the local repository, ready to be pushed to the remote repository.
git add --all
or
git add <name-file>
Before commit the files it's possible to do as many changes as necessary to them, and when they are finally ready, run the add
command again.
git commit -m '<your message here>'
git push origin master
or
git push origin <name-branch>
To force files to be pushed in the remote repository, overwriting the existing ones:
git push -f origin <name-branch>
The following commands are used to inspect the status of the local repository relative to the remote one.
git remote update git status
To see if there are any difference between the working directory and the HEAD:
git diff HEAD
To get he list of commits present in the local repository:
git log --oneline
git show --pretty="" --name-only HEAD
To fetch changes from the remote repository and merge them into the local one:
git pull
To force files to be pulled in the local repository, losing changes not already pushed in the remote one:
git fetch --all git reset --hard origin/<name-branch>
To delete only the last commit from the remote repository, without affecting the local:
git push origin +HEAD^:master