Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git: how to retrieve all files as of a certain date

Tags:

git

I'm sure this can be done (?) (in clearcase it would be quite simple).

like image 404
c-urchin Avatar asked Jul 01 '10 20:07

c-urchin


People also ask

How do I pull everything in git?

To get all the changes from all the branches, use git fetch --all . And if you'd like to clean up some of the branches that no longer exist in the remote repository, git fetch --all --prune will do the cleaning up!

What does fetch all do in git?

git fetch <remote> Fetch all of the branches from the repository. This also downloads all of the required commits and files from the other repository. git fetch <remote> <branch>

Can I pull a specific file from git?

Short Answergit checkout origin/master -- path/to/file // git checkout <local repo name (default is origin)>/<branch name> -- path/to/file will checkout the particular file from the downloaded changes (origin/master).


1 Answers

Use git log to determine a suitable revision to switch to, e.g.:

git log --since='2010-04-01' --until='2010-04-02'

This will show all the commits on 2010-04-01, so just pick the one that corresponds to the instant you want the files for, and note its commit id. Then just use git checkout COMMIT-ID to switch the workspace to that commit. This will detach your workspace (HEAD) from the current branch, use git checkout master to return.

like image 113
araqnid Avatar answered Sep 23 '22 18:09

araqnid