Ace
Ace

Reputation: 1611

In Git How to Refer to Current Branch without using its full name?

Is there a way to refer to the current branch during git push origin instead of using full name like:

git push origin myBranch

I was thinking of linux "." like operator to refer to current branch without having to use its full name.

Upvotes: 1

Views: 175

Answers (1)

smac89
smac89

Reputation: 43234

Do this:

git branch --set-upstream-to origin/myBranch

Then you can just do

git push

From the man page:

--set-upstream-to=<upstream> Set up <branchname>'s tracking information so <upstream> is considered <branchname>'s upstream branch. If no <branchname> is specified, then it defaults to the current branch.

See this other answer for details

Upvotes: 2

Related Questions