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

  • Home
  • SEARCH
  • 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 997777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:05:20+00:00 2026-05-16T07:05:20+00:00

How can I clone git repository with specific revision, something like I usually do

  • 0

How can I clone git repository with specific revision, something like I usually do in Mercurial:

hg clone -r 3 /path/to/repository
  • 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-16T07:05:21+00:00Added an answer on May 16, 2026 at 7:05 am

    UPDATE 2 Since Git 2.5.0 the feature described below can be enabled on server side with configuration variable uploadpack.allowReachableSHA1InWant, here the GitHub feature request and the GitHub commit enabling this feature. Note that some Git servers activate this option by default, e.g. Bitbucket Server enabled it since version 5.5+. See this answer on Stackexchange for a exmple of how to activate the configuration option.

    UPDATE 1 For Git versions 1.7 < v < 2.5 use git clone and git reset, as described in Vaibhav Bajpai’s answer

    If you don’t want to fetch the full repository then you probably shouldn’t be using clone. You can always just use fetch to choose the branch that you want to fetch. I’m not an hg expert so I don’t know the details of -r but in git you can do something like this.

    # make a new blank repository in the current directory
    git init
    
    # add a remote
    git remote add origin url://to/source/repository
    
    # fetch a commit (or branch or tag) of interest
    # Note: the full history up to this commit will be retrieved unless 
    #       you limit it with '--depth=...' or '--shallow-since=...'
    git fetch origin <sha1-of-commit-of-interest>
    
    # reset this repository's master branch to the commit of interest
    git reset --hard FETCH_HEAD
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 501k
  • Answers 501k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I have a strong suspicion that you are changing the… May 16, 2026 at 2:19 pm
  • Editorial Team
    Editorial Team added an answer try the JSON classes in the as3corelib library http://github.com/mikechambers/as3corelib basic… May 16, 2026 at 2:19 pm
  • Editorial Team
    Editorial Team added an answer Here is a symbolic solution from Mathematica: May 16, 2026 at 2:19 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Suppose I git clone a repository. Then edit a file A and delete a
I'm looking for a DVCS which would allow me to use something like a
Drupal has a GitHub repository at http://github.com/drupal/drupal I, being a newbie to Git and
How does git submodule add -b work? After adding a submodule with a specific
I have gitosis setup and working wonderfully using ssh. git@domain.com:repository.git works just as expected.
With SVN, I had a single big repository I kept on a server, and
I've read a great deal of go from svn to git and other git-svn
I'm running a mixed environment, and keep a central, bare repository where I pull
After thinking that I finally figured git out, I'm now finding myself super-confused about
I've created several bash aliases in Git Bash on Windows, to launch executables from

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.