I have a local repository that I've cloned from my remote repository (all on one machine). I wanted to make sure that my remote repository picked the changes from my local repository so I did a git push origin
.
I changed my working directory to my remote repository; the change had propagated to the log file (i.e. doing git log
showed the change) but my actual working directory didn't show the change. I did a git checkout HEAD
but the CWD still didn't change. It wasn't until I did a git checkout --force HEAD
that the CWD synced up.
I suspect this is happening because the remote repository isn't a bare repository. So two questions:
- Is there a way that I can make the remote repository automatically sync (i.e. discard local changes) on a
git push
? - Why do I need to to use
--force
to get it to sync up? What should be the process of syncing it up?