top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to Pull/Fetch a specific GIT branch (and NOT clone entire repository) to the AIX server

+1 vote
1,415 views

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.

posted Dec 4, 2013 by Dewang Chaudhary

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

1 Answer

+1 vote

Consider shallow cloning -- a call

 git checkout --depth 1 --branch foo

would fetch just the tip commit of a branch named "foo" plus all the objects necessary to represent this commit which is essentially what you want.

In real life this call will fetch more than just the tip commit due to a bug (or misfeature?) in the implementation [1], [2] but I reckon you could live with this until it's fixed.

  1. http://thread.gmane.org/gmane.comp.version-control.git/212912
  2. http://thread.gmane.org/gmane.comp.version-control.git/212946/focus=213023
answer Dec 4, 2013 by Garima Jain
git checkout --depth 1 --branch foo
should be
git checkout --depth 1 --branch foo REPO_URL
Similar Questions
+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.

+1 vote

I am new in git and I am trying to understand it.

I have this case:

a. I develop a html file in several days with daily commit.
b. Some weeks after I noticed that I lost part of the code.
c. I located a code 3 commits ago.

then how I can fetch from the remote repository the html file as was 3 commit before (the whole file)?

...