git checkout -b <branch name>
Example:
git checkout -b task-1
If you just want to publish a branch and continue to track the branch, the first
time you push the branch on the remote, you have to add -u
to the push
command.
git push -u origin <branch name>
Example:
git branch -u origin task-1
Once your branch is already tracked on the remote, you can simply do:
git push
When you have updates in your file system, you need to add them to git staging. For that, you can do it for all the files with:
git add .
or you can specify file path by file path
git add <path1> <path2> ...
You will not be able to commit your changes if they are not staged. Once your files are staged, you can simply commit your modifications with:
git commit -m "<message>"
Example:
git commit -m "Added run script"
git checkout <branch name>
Example:
git checkout task-1
To get the latest updates done on the remote branches, simply do:
git pull