Search code examples
gitgit-remote

How to reference my current working branch in git


I was wondering, and couldn't find too much online...is there a way to reference your current branch when doing a git push? For example, say I have 100s of branches created for bugs and stuff remotely and I constantly work on different branches every time, so if I'm on branch Bug1 and i make a change, I gotta add, commit, and then push remotely. Now if I change to Bug2 branch, I also gotta add, commit, and push remotely.

For each push I do, the syntax is as follow:

git push origin Bug1

or

git push origin Bug2

My question is, is there a way to reference the current branch so I can just do like this and not have to specify the same branch every time?:

git push origin -c    <-- -c for like current branch i'm on

Any help would be appreciated. Thanks!


Solution

  • Git config push.default

    You want to use either upstream or current (or if you are using an older version of Git, tracking instead of upstream)