How to push branch to remote repository

On a git project, branched are used to keep different working copies of files. To list the local and remote branches, the command is

git branch -a

Push command, will send files to a remote repository. Its a good practise to always "pull" from remote the latest files, before doing any "push".

This example, the user is in the branch "master", where user wants to push contents in own branch "dev" to the remote named "origin" with branch "dev. 

git checkout dev
git pull origin
git push origin dev

Note: If this the remote branch does not have the branch "dev", use following push

git push -u origin dev



No comments:

Blog Archive