checkout a single file to a given commit

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

checkout a single file to a given commit

fabu
How can I checkout a single file to a given commit?

Let's assume the following:

commit A <- HEAD
- foo.c
- foo.h
- bla.c
- blop.c

commit B
- foo.c
- bla.c
- blop.c

I would like to checkout foo.c to the version of commit B. But I don't want
the other files in commit A to be impacted. How can I do that?
In fact I would like the equivalent of the command line:

git checkout sha_commit_id_of_B -- foo.c

How can I do that with SmartGit???

Thanks and best regards - Fabrice


[Non-text portions of this message have been removed]

Reply | Threaded
Open this post in threaded view
|

Re: checkout a single file to a given commit

syntevo Support
> How can I checkout a single file to a given commit?

You may open the Log for the file, navigate to the corresponding commit and use Save As in the Files area.

--
Best regards,
Marc Strapetz
=============
syntevo GmbH
http://www.syntevo.com
http://blog.syntevo.com





05/10/2011 19:50 - Fabrice Sauterel wrote:

> How can I checkout a single file to a given commit?
>
> Let's assume the following:
>
> commit A <- HEAD
> - foo.c
> - foo.h
> - bla.c
> - blop.c
>
> commit B
> - foo.c
> - bla.c
> - blop.c
>
> I would like to checkout foo.c to the version of commit B. But I don't want
> the other files in commit A to be impacted. How can I do that?
> In fact I would like the equivalent of the command line:
>
> git checkout sha_commit_id_of_B -- foo.c
>
> How can I do that with SmartGit???
>
> Thanks and best regards - Fabrice
>
>
> [Non-text portions of this message have been removed]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: checkout a single file to a given commit

Eugene Kashpureff
Checking out several files(or a whole path) from a different branch in this manner is tedious, if they have not been updated all at once in a recent commit.  Additionally, the "Save File As" dialog which is opened makes no attempt to remember the last-used save location, instead defaulting to Program Files.

I have found a usable alternative: keep two copies of a repo locally, in different directories. The second is used purely Read-Only(copying files out), while the first is kept as my Working copy.

I would very much appreciate the addition of a Check Out File/Path dialog window alongside the existing Check Out functionality. This window would need to have a branch/commit tree explorer, similar to the current Check Out window, as well as a Path/File chooser similar to what is used in the Main Window's Directories/Files tree browsers.

Thank you.

--- In [hidden email], syntevo Support <smartgit@...> wrote:

>
> > How can I checkout a single file to a given commit?
>
> You may open the Log for the file, navigate to the corresponding commit and use Save As in the Files area.
>
> --
> Best regards,
> Marc Strapetz
> =============
> syntevo GmbH
> http://www.syntevo.com
> http://blog.syntevo.com
>
>
>
>
>
> 05/10/2011 19:50 - Fabrice Sauterel wrote:
>
> > How can I checkout a single file to a given commit?
> >
> > Let's assume the following:
> >
> > commit A <- HEAD
> > - foo.c
> > - foo.h
> > - bla.c
> > - blop.c
> >
> > commit B
> > - foo.c
> > - bla.c
> > - blop.c
> >
> > I would like to checkout foo.c to the version of commit B. But I don't want
> > the other files in commit A to be impacted. How can I do that?
> > In fact I would like the equivalent of the command line:
> >
> > git checkout sha_commit_id_of_B -- foo.c
> >
> > How can I do that with SmartGit???
> >
> > Thanks and best regards - Fabrice
> >
> >
> > [Non-text portions of this message have been removed]
> >
> >
>