top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to clone a particular revision in GIT?

+1 vote
1,031 views

I can get the latest revision number by command "git describe --tags", but how can I display a list of revisions or a particular revision based on the date of my commit id?

posted May 18, 2016 by Tarun Singhal

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

It's unclear what you are asking because the title mentions cloning and the message text apparently talks about inspecting local
history.

So, assuming you're talking about inspecting local history I invite you to read the "gitrevisions" manual page (run git help revisions) which describes multiple ways to list commits by the dates they were made.

In short, you use git log or its lower-level cousin git rev-list and pass it something like master@{2016-050-18 14:11:00} or use their command-line options "--since" and "--until" to specify a range of timestamps.

Note that accessing commits by date is imprecise by its nature and, while useful sometimes, might indicate you're trying to do something wrong way.

answer May 18, 2016 by Jagan Mishra
Similar Questions
+1 vote

There's a challenge that i'm currently facing after migration from WINCVS to GIT. The problem here is I need to pull/fetch a specific branch (and NOT clone the entire repository) from the repository to a particular location on the AIX server.

Earlier while using WINCVS this functionality was achievable using JCVSExport package as we could just checkout a particular branch and fetch the package on to the server location.
WINCVS Command : java JCVSExport -h cvs.xyz.com -u abcde -p xxxxxx -d /abcd/cvs/testing -c "$REPOSITORY" -m "$PACKAGE"

I am not able to achieve the same functionality using GIT. I DO NOT want to clone the entire repository on the AIX server instead I just want to fetch/pull a specific branch contents on the server. Can someone please help me out with the solution or any possible way with which I can achieve the same functionality.

+3 votes

When we clone a remote GIT repository, all folders/files will be cloned. This will consume lot of disk space in our local machine.
Is there a way to clone only few folders & exclude others?

This is possible in clearcase snapshot view by changing load rules.

+2 votes

I've been trying to figure out why I can't push from a shallow clone (using --depth) to a repository. I've made simple examples where it works, but I've read that in doesn't work in every case. However, I can't come up with a case where it doesn't work. Googling gives this answer: http://stackoverflow.com/questions/6900103/why-cant-i-push-from-a-shallow-clone,

but I don't completely understand the explanation,Please explain.

+1 vote

We're attempting to write some scripts to perform automatic commits for certain files under certain conditions. We wish to use the just committed revision number to perform some other logging operation. The --xml command line option on many of the other commands (info, status, etc.) are fantastic, but the commit command does not allow this.

I'm currently attempting to parse the standard output of the commit message to grab it, but feel this is less than optima as it seems very error prone.

Is there any consideration to add an --xml option to the commit command output or a better programmatic means to grab the commit revision?

$ svn commit 1.txt -m "Checkin message". 
Sending 1.txt 
Transmitting file data . 
Committed revision 3272. 
0 votes

Is there any reason why 'git clone -b' only takes a branch (from refs/heads/) or a tag (from refs/tags/) ?

Background: At $dayjob we're using some kind of 'hidden' refs (in refs/releases/) to communicate between the 'branch integrator' (who creates the ref in refs/releases/) and the 'build master' who wants to build that ref.

It would be a little easier if the build master could simply say

git clone -b refs/releases/the-release-for-today URL
instead of: git clone... ; cd ... ; git fetch... ; git checkout....

Any answer or even a better idea to solve that is appreciated.

...