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

Ryan Schmidt ryandesign at macports.org
Fri Nov 25 15:27:04 CET 2016


> On Nov 25, 2016, at 8:25 AM, rod <rod at pu-gh.com> wrote:
> 
> Depends what you want to do when you get there really.
> 
> Disclaimer: --hard will wipe out any changes you have in your WC
> 
> This will move your current branch to point to that commit...
> 
> git reset --hard 72164060176afd82227b03e05aede0ce292f093f
> 
> But this applies to the whole git checkout, not a subtree (as i think i remember you could do with svn...)
> 

Thanks, but:
"I don't want to commit or stash or do anything else to files not in the current directory."




> On Fri, Nov 25, 2016 at 2:06 PM Ryan Schmidt <ryandesign at macports.org> wrote:
> I just committed an update to the lighttpd port, but now I want to get back to the previous version.
> 
> With svn, I would have done:
> 
> cd $(port dir lighttpd)
> svn up -r 151090
> 
> How do I do this with git?
> 
> I tried:
> 
> cd $(port dir lighttpd)
> git checkout 72164060176afd82227b03e05aede0ce292f093f
> 
> git complained:
> 
> error: Your local changes to the following files would be overwritten by checkout:
>         net/curl/Portfile
> Please commit your changes or stash them before you switch branches.
> Aborting
> 
> I don't want to commit or stash or do anything else to files not in the current directory. I only want the files in the current directory temporarily rolled back to a previous state for testing.
> 



More information about the macports-dev mailing list