I’m trying to use git as a way keeping my source code up-to-date when working between different computers (I originally used Dropbox, but this became unmanageable).
From my understanding, when you use the command git pull it will fetch any changes from the remote repository and merge the changes with any existing files in your local repository. However, if I have redundant/obsolete files in my local repository, it will not remove them automatically. Likewise, if I remove a file from my local repository and push the changes to the server, the server will not remove that deleted file.
How to I solve this problem? What are the necessary commands?
Thanks!
The simplest way perform
git pulland then performgit reset --hardwhich will forcibly reset the working directory to match the remote.