
How To Commit And Push In Git
1
Create a task branch
With a clean master branch checked out, you can create a task branch by typing:
git checkout -b task_branchwhere the task_branch is the name of the branch you want to create. By using the -b option it will both create a new branch and check it out.
2
Do your work and commit
As your are doing work you can commit regularly, and you must also commit when you are finished with your task. You can commit by typing:
git commit -am "commit message"and you should leave a detailed commit message describing the changes you made.
3
Merge your work into master
Now that you’ve finished your task you need to checkout master and merge your work. To checkout master simply type:
git checkout masterand to merge your task branch type:
git merge task_branchwhere task_branch is the name of your branch.
4
Push the master branch
Now that your work is merged, go ahead and push the master branch by typing:
git push origin master