Pushing a new branch to the remote

Obviously, we can create and push a new branch to the remote to make our work public and visible to other collaborators; for instance, I will create a new branch for a new recipe, then I will push to the remote GitHub server. Follow these simple steps:

  1. Create a new branch, for instance Risotti.
  2. Add to it a new file, for example, Risotto-alla-Milanese.md, and commit it.
  3. Push the branch to the remote using git push -u origin Risotti:
      [11] ~/Cookbook (master)
      $ git branch Risotti

      [12] ~/Cookbook (master)
      $ git checkout Risotti

      [13] ~/Cookbook (Risotti)
      $ notepad Risotto-alla-Milanese.md
 
      [14] ~/Cookbook (Risotti)
      $ git add Risotto-alla-Milanese.md
 
      [15] ~/Cookbook (Risotti)
      $ git commit -m "Add risotto alla milanese recipe ingredients"
      [Risotti b62bc1f] Add risotto alla milanese recipe ingredients
       1 file changed, 15 insertions(+)
       create mode 100644 Risotto-alla-Milanese.md

      [16] ~/Cookbook (Risotti)
      $ git push -u origin Risotti
      Total 0 (delta 0), reused 0 (delta 0)
      Branch Risotti set up to track remote branch Risotti from origin.
      To https://github.com/fsantacroce/Cookbook.git
       * [new branch]      Risotti -> Risotti

Before continuing, we have to examine in depth some things that happened after this git push command.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.81.240