I use a USB stick with a bare git repo to propagate commits from a development PC to a server that is not immediately accessible. One of my teammates committed some changes, and now I must merge.
I made some changes to my dev directory. I committed them; I pushed them to the USB stick. After I moved the USB stick to the computer with repo access the git push
failed because it was not a fast forward on the origin. A coworker had done some work and committed his changes and effectively there were now two branches. I then performed a git fetch
which pulled my coworker's commits from the origin onto the USB stick.
However, the USB stick with the bare repo still had its refs/heads/master pointing at the changes I had pushed from my dev box to the stick, while the refs/remote/origin/master was pointing at my coworker's changes that I had pulled from the origin onto the stick.
I was able to fetch the changes onto the USB stick, but now I do not know how to merge them onto the dev PC. A plain git merge
in my working directory tells me "Already up-to-date." A plain git merge
in my USB bare repo tells me "Fatal: This operation must be run in a work tree".
Inside the bare repository of the USB stick git show-ref
tells me I have refs/head/master
and refs/remote/origin/master
, but I do not know the command to execute inside the development tree that will merge my tree with the remote/origin/master changes.