Fixed typo
Source Link

A slight variation of the solutions already given here:

  1. Create a local branch based on some other (remote or local) branch:

     git checkout -b branchname
    
  2. Push the local branch to the remote repository (publish), but make it trackable so git pull and git push will work immediately

     git push -u origin HEAD
    

    Using HEAD is a "handy way to push the current branch to the same name on the remote". Source: https://git-scm.com/docs/git-push In Git terms, HEAD (in uppercase) is a reference to the top of the current branch (tree).

    The -u option is just short for --set-setupstreamupstream. This will add an upstream tracking reference for the current branch. you can verify this by looking in your .git/config file:

    Enter image description here

A slight variation of the solutions already given here:

  1. Create a local branch based on some other (remote or local) branch:

     git checkout -b branchname
    
  2. Push the local branch to the remote repository (publish), but make it trackable so git pull and git push will work immediately

     git push -u origin HEAD
    

    Using HEAD is a "handy way to push the current branch to the same name on the remote". Source: https://git-scm.com/docs/git-push In Git terms, HEAD (in uppercase) is a reference to the top of the current branch (tree).

    The -u option is just short for --set-setupstream. This will add an upstream tracking reference for the current branch. you can verify this by looking in your .git/config file:

    Enter image description here

A slight variation of the solutions already given here:

  1. Create a local branch based on some other (remote or local) branch:

     git checkout -b branchname
    
  2. Push the local branch to the remote repository (publish), but make it trackable so git pull and git push will work immediately

     git push -u origin HEAD
    

    Using HEAD is a "handy way to push the current branch to the same name on the remote". Source: https://git-scm.com/docs/git-push In Git terms, HEAD (in uppercase) is a reference to the top of the current branch (tree).

    The -u option is just short for --set-upstream. This will add an upstream tracking reference for the current branch. you can verify this by looking in your .git/config file:

    Enter image description here

Applied some formatting (as a result the diff looks much more extensive than it really is - use view "side-by-side markdown" to compare).
Source Link
Peter Mortensen
  • 28.7k
  • 21
  • 95
  • 123

A slight variation of the solutions already given here:

  1. Create a local branch based on some other (remote or local) branch:

    git checkout -b branchname

     git checkout -b branchname
    
  2. Push the local branch to the remote repository (publish), but make it trackable so git pull and git push will work immediately

     git push -u origin HEAD
    

    gitUsing HEAD is a "handy way to push the current branch to the same name on the remote". Source: -u originhttps://git-scm.com/docs/git-push In Git terms, HEAD (in uppercase) is a reference to the top of the current branch (tree).

    The -u option is just short for --set-setupstream. This will add an upstream tracking reference for the current branch. you can verify this by looking in your .git/config file:

    Enter image description here

Using HEAD is a "handy way to push the current branch to the same name on the remote". Source: https://git-scm.com/docs/git-push In git terms, HEAD (in uppercase) is a reference to the top of the current branch (tree).

The -u option is just short for --set-setupstream. This will add an upstream tracking reference for the current branch. you can verify this by looking in your .git/config file:

enter image description here

A slight variation of the solutions already given here:

  1. Create a local branch based on some other (remote or local) branch:

    git checkout -b branchname

  2. Push the local branch to the remote repository (publish), but make it trackable so git pull and git push will work immediately

    git push -u origin HEAD

Using HEAD is a "handy way to push the current branch to the same name on the remote". Source: https://git-scm.com/docs/git-push In git terms, HEAD (in uppercase) is a reference to the top of the current branch (tree).

The -u option is just short for --set-setupstream. This will add an upstream tracking reference for the current branch. you can verify this by looking in your .git/config file:

enter image description here

A slight variation of the solutions already given here:

  1. Create a local branch based on some other (remote or local) branch:

     git checkout -b branchname
    
  2. Push the local branch to the remote repository (publish), but make it trackable so git pull and git push will work immediately

     git push -u origin HEAD
    

    Using HEAD is a "handy way to push the current branch to the same name on the remote". Source: https://git-scm.com/docs/git-push In Git terms, HEAD (in uppercase) is a reference to the top of the current branch (tree).

    The -u option is just short for --set-setupstream. This will add an upstream tracking reference for the current branch. you can verify this by looking in your .git/config file:

    Enter image description here

Source Link
bg17aw
  • 2.4k
  • 1
  • 17
  • 26

A slight variation of the solutions already given here:

  1. Create a local branch based on some other (remote or local) branch:

    git checkout -b branchname

  2. Push the local branch to the remote repository (publish), but make it trackable so git pull and git push will work immediately

    git push -u origin HEAD

Using HEAD is a "handy way to push the current branch to the same name on the remote". Source: https://git-scm.com/docs/git-push In git terms, HEAD (in uppercase) is a reference to the top of the current branch (tree).

The -u option is just short for --set-setupstream. This will add an upstream tracking reference for the current branch. you can verify this by looking in your .git/config file:

enter image description here