Git push

April 5, 20191 min readUpdated 11/19/2020

git push is used to upload local repository commits/changes to a remote repository. This is how you transfer commits from your local repository to a remote repo. It’s the counterpart to git pull or git fetch. Pushing has the potential to overwrite changes so you have to be careful when pushing.

// push local commits/changes to remote
git push

// force the push even if it results in a non-fast-forward merge. Do not use the --force flag unless you’re absolutely sure you know what you’re doing.
git push --force