Using git, I often create local branches and then want to push them to the remote (e.g. Github). This requires the -u
or --set-upstream
flag.
Here is what git
outputs without this flag:
$ git checkout -b newbranch
$ git push
fatal: The current branch cross_val has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin newbranch
Is there a way to have this suggestion copied to my prompt? So that I don't have to type it. Something like:
$ git checkout -b newbranch
$ git push
fatal: The current branch cross_val has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin newbranch
$ <tab>
$ git push --set-upstream origin newbranch