I am new in git
and I am practicing. I created a local branch but I saw that when I did git push
my branch was not uploaded to the repository. I ha
You don't, see below
I find this 'feature' rather annoying since I'm not trying to launch rockets to the moon, just push my damn branch. You probably do too or else you wouldn't be here!
Here is the fix: if you want it to implicitly push for the current branch regardless of if that branch exists on origin just issue this command once and you will never have to again anywhere:
git config --global push.default current
So if you make branches like this:
git checkout -b my-new-branch
and then make some commits and then do a
git push -u
to get them out to origin (being on that branch) and it will create said branch for you if it doesn't exist.
Note the -u bit makes sure they are linked if you were to pull later on from said branch. If you have no plans to pull the branch later (or are okay with another one liner if you do) -u is not necessary.