I sometimes want to use the current branch name to use in git commands. For example
git push origin feature/really-long-branch-name
Is there a git command that will give just the branch name so I can do something like the following?
git push origin current_branch
There is git rev-parse --abbrev-ref HEAD
but that's exactly useful in this case. Setting a default branch isn't that helpful either since the branch name changes often. Changing the default behavior of git push
isn't what I'm looking for either since it still means having to type in the full branch name the first time I push
.
Edit:
Moderators, this question is not a dupe so please do not close for that reason. Please read the bolded part of my question carefully.