I'm using Git to sync working directories between my notebook and my desktop computer:
- there's a remote
origin
known on both machines asorigin
which holds a bare repo - on the notebook, theres an additional remote called
desktop
that holds a repo with working copy - on the desktop, theres an additional remote called
notebook
that holds a repo with working copy
When I'm working at home, I'm pushing commits via a (slow) VPN connection to origin
and desktop
. Sometime, it happens that I started a branch on the desktop machine, left my workplace with this branch being checked out and continue work on the notebook. Pretty simple so far.
Things get problematic when I'm going to push changes back to the desktop
machine from the notebook: the Git push error '[remote rejected] master -> master (branch is currently checked out)' problem occurs when the current branch is currently checked out on desktop
.
In order to avoid the error, I'd like to know in advance which branch is currently checked out on desktop
. Is there a way to achieve this?
Yes, of course. I could wait until I'm back at work before pushing and then check out a different branch on desktop. I could also create a temp branch every time I leave my workplace. I could open a RDP session to my desktop machine and check out a different branch. I know that. But that's not what I'm asking for: no workaround.