Working with git: git equivalent of "svn up -r..."

Rainer Müller raimue at macports.org
Fri Nov 25 16:03:33 CET 2016


Hello,

Git always works on the whole tree, there is no equivalent to the
mixed-revision working copies of Subversion where individual files can
be from different revisions.

On 2016-11-25 15:27, Davide Liessi wrote:
> Try in the directory
> git checkout 72164060176afd82227b03e05aede0ce292f093f .
> or even
> git checkout 72164060176afd82227b03e05aede0ce292f093f <specific file>
> 
> The last argument can be any path to file or directory in the repository.
> 
> Unfortunately this also stages the checked-out files for commit, so
> you probably want also to
> git reset HEAD .
> or
> git reset HEAD <specific file>

This is the closest you can get and it would be roughly equivalent to
running 'svn cat -rX Portfile > Portfile', but for all files in the
given path.

This is especially confusing as 'git checkout' operates completely
different depending on whether you give it a path or a branch/commit
reference.

When you are done and you want go back to the version in the latest
commit on your current branch, use: git checkout HEAD -- .

Rainer


More information about the macports-dev mailing list