Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1072481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:52:00+00:00 2026-05-16T20:52:00+00:00

The problem is the following: how to fetch a few files from a previous

  • 0

The problem is the following: how to fetch a few files from a previous commit in git?

I could get the files one by one and replace them by their old version:

git show <commit>:<path>  >!  path

However, I would like to know whether there is a different way of performing the same thing, possibly with git reset.

In fact, I gather that

git reset <commit> <path>

puts the old file into the index. But how can the files in the index be moved back to the working tree? Or is this a bad approach?

PS: There is a wonderful graphical explanation that makes everything clear: http://marklodato.github.com/visual-git-guide/.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T20:52:00+00:00Added an answer on May 16, 2026 at 8:52 pm

    To put a file from a given revision into both the index and the working tree in one step, check it out:

    git checkout <commit> <path>
    

    If you’ve already put it only into the index, using git reset <commit> <path>, then no need to specify a commit:

    git checkout <path>
    

    That is, by default, git checkout <path> copies from index to work tree, but if provided a revision argument, it will copy from there into the index first.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Following on from a previous question, ( previous question here ), the problem I'm
Problem: I want to get all locations from a database and encase them all
is there an easy way to solve the following problem. Let's say I fetch
The following code fetch all data (by clicking a.info link) from a php file
I've following problem, which I've not been able to do successfully. Your help will
I have the following problem: I have an HTML textbox ( <input type=text> )
I have the following problem using subversion: I'm currently working on the trunk of
I have the following problem using template instantiation [*]. file foo.h class Foo {
I have the following problem in my Data Structures and Problem Solving using Java
I have the following problem: I open the dialog, open the SIP keyboard to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.