git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "James Sadler" <freshtonic@gmail.com>
To: "Ittay Dror" <ittayd@tikalk.com>
Cc: git@vger.kernel.org
Subject: Re: how do i re-add a file?
Date: Tue, 1 Apr 2008 22:41:23 +1100	[thread overview]
Message-ID: <e5e204700804010441r61d365d6se0f58c2f49d3058@mail.gmail.com> (raw)
In-Reply-To: <47F21814.6000705@tikalk.com>

There are at least a couple of ways to do this.

git show <revision>:<file_name>

e.g. git show HEAD^:builtin-log.c

That will output the content to the console of the file
'builtin-log.c' at the parent revision of the current commit.   You
can redirect it to a file if you want.

git checkout <rev> <file_name>

e.g. git checkout HEAD^ builtin-log.c

Works the same as above, except the file will be written to your
working tree without you having to redirect the output to a file.

Take a look at the help for 'checkout' and 'show'. (e.g. git checkout --help )

In the above examples, 'HEAD^' is just a shortcut for specifying a
revision without entering the entire SHA1 of the commit.  See
http://www.kernel.org/pub/software/scm/git/docs/git-rev-parse.html for
more information on the various ways you can specify revisions.

Another way to look at file content at a particular revision is via
the 'gitk' GUI tool that comes with git.  Fire it up by entering
'gitk' at the command line while inside your repo.  In the pane on the
left, select the revision that you are interested in.  On the
bottom-right pane, select the radio button labeled 'tree' and navigate
through that to find you file.  When you select it, the content of the
file will be displayed on the bottom-left pane.

-- 

James.

On 01/04/2008, Ittay Dror <ittayd@tikalk.com> wrote:
> I did git-rm on a file and committed. Made some changes to my sources
>  and committed. Now I want the file back. How can I do that? Related to
>  that, how do I revert my files to some past commit state so that the
>  commits in between are kept in the history?
>
>  Thank you,
>  Ittay
>
>  --
>  Ittay Dror <ittayd@tikalk.com>
>  Tikal <http://www.tikalk.com>
>  Tikal Project <http://tikal.sourceforge.net>
>
>
>  --
>  To unsubscribe from this list: send the line "unsubscribe git" in
>  the body of a message to majordomo@vger.kernel.org
>  More majordomo info at  http://vger.kernel.org/majordomo-info.html
>


-- 
James

  reply	other threads:[~2008-04-01 11:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-01 11:10 how do i re-add a file? Ittay Dror
2008-04-01 11:41 ` James Sadler [this message]
2008-04-01 11:41 ` Miklos Vajna
  -- strict thread matches above, loose matches on Subject: below --
2008-04-01 11:14 Ittay Dror

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e5e204700804010441r61d365d6se0f58c2f49d3058@mail.gmail.com \
    --to=freshtonic@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=ittayd@tikalk.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).