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?
I don't want to create any local branches.
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:
git checkout master ;# you should have a 'master' branch by default
git pull ;# to get the newest changes from the remote repo
Issue git pull
on that branch anytime you want to stay up to date with the remote. You can see how local tracking branches are configured using git 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With