Let's say that the remote is origin and the master branch, and they say that you already have master , you can try the following:
git fetch origin git reset
This basically just takes the current branch and points it to the HEAD remote branch.
WARNING As stated in the comments, this will discard your local changes and , rewriting everything at the beginning .. p>
Or you can use plumbing commands to do essentially the same thing:
git fetch <remote> git update-ref refs/heads/<branch> $(git rev-parse <remote>/<branch>) git reset --hard
EDIT: I would like to briefly explain why this works.
In the .git folder, you can save commits for any number of repositories. Because the commit hash is actually a validation method for the contents of the commit, and not just a randomly generated value, it is used to map sets of commits between repositories.
A branch is just a named pointer to a given hash. Here is an example:
$ find .git/refs -type f .git/refs/tags/v3.8 .git/refs/heads/master .git/refs/remotes/origin/HEAD .git/refs/remotes/origin/master
Each of these files contains a hash indicating a commit:
$ cat .git/refs/remotes/origin/master d895cb1af15c04c522a25c79cc429076987c089b
They are all intended for the internal git storage engine and work independently of the working directory. By doing the following:
git reset
git will point to the current branch with the same hash value that the start / master points to. Then it forcibly changes the working directory according to the file structure / contents in this hash.
To see this at work, try the following:
git checkout -b test-branch