
branches named like remotes/origin/master or such.įetching new commits from the remote repository will not change anything about your local working copy. These are then in your repository as "remote tracking branches", e.g. When fetching from a repository, you will copy all or some of the branches there to your repository. You need to understand that a Git repository is not just a tree of directories and files, but also stores a history of those trees - which might contain branches and merges. Thanks to the comments and other answers which helped me form a better reply. Note that the git clean command comes with a handy dry-run option to avoid making that mistake a little too fast: git clean -f -d -x -nĭon’t actually remove anything, just show what would be done.Īs the top-rated answer, I felt compelled to revisit my not really answering former reply. To clean them out, run: git clean -f -d -x gitignore files) and become hidden to the git tracking. Some files are declared to be ignored (via. These can be cleaned out using git clean -f -d These would have been removed by the above git reset -hard The untracked files

The files/changes The not staged for commit changes Note: This would have left 'un-synced' any other branch. To sync up the current branch with the remote, and potentially lose local work, reset it to the remote position: git reset -hard origin/Īgain, caution: this would clear out the local changes (non-committed changes & non-pushed commits). The pull command also has the prune option ( -prune or -p) see git-scm doc git pull -pĪll local branches could potentially be out of sync.

git fetch -pruneīefore fetching, remove any remote-tracking references that no longer exist on the remote. When fetching from a repository, the new (remote) references are synced up automatically but the old ones aren't cleaned out from the local.

While not really operating a 'full sync' with the remote, the following will probably achieve what you need.
