Warning: git novice here.
I have downloaded the source code of an open-source project (ffmpeg, to be exact) using git (git clone). I checked out an older revision in order to do test it (git checkout [version number]), and git told me that I’m now in a detached HEAD state. Now I want to resync again to the latest remote revision, but I don’t know how.
I don’t want to create any local branches. I haven’t made any local changes that I want to keep. I don’t want to do any of those fancy things that git can do when you are a serious developer (which I’m not). I just want my local source tree to be the same than the latest remote version.
git checkout . doesn’t do anything. git pull tells me that I’m not currently on a branch. Short of erasing everything and do a git clone again, what else can I do?
Sure you do. You just want a “local tracking branch”, which is a branch that tracks a remote branch, making it easy to stay up to date with the project.
Try this:
Issue
git pullon that branch anytime you want to stay up to date with the remote. You can see how local tracking branches are configured usinggit remote show origin, and I strongly recommend spending a little time in the git-scm docs even if you don’t want to do fancy git stuff. A little background knowledge will help you navigate that source tree nearly any way you want.