What is git equivalent of the following cvs comman

2019-09-21 18:19发布

问题:

we are moving from cvs to git. I want to know what the following cvs commands does and its output

cvs -n checkout -p -r${RELEASE} ${MODULE}

I also need git equivalent of following cvs command.

Thanks for your help

回答1:

In a nutshell:

   git clone url

will give you the whole repository. If then you need to checkout a specific tagged release, you can do

 git checkout tags/<tag_name>

Even better, you can checkout and create a branch

  git checkout tags/<tag_name> -b <branch name>

If you only need to clone locally a specific release, try:

     git clone --branch <tag_name> <repo_url>


回答2:

It should show the output-errors in checking out the revision after the -r option in MODULES. The -n option just simulate the command you are giving. Anyway, take a look to the documentation

EDIT/ADDING:

-r tag: Use the revision specified by the tag argument instead of the default head revision. As well as arbitrary tags defined with the tag or rtag command, two special tags are always available: HEAD refers to the most recent version available in the repository, and BASE refers to the revision you last checked out into the current working directory



回答3:

To check if repo exists, if exists 0 is returned else 128 is returned

**git ls-remote --heads http://user:pass@github.com:user/repo.git**

To check if branch exists in repo, if branch not found no output else one line is printed

**git ls-remote --heads http://user:pass@github.com:user/repo.git branch**

To check if tag exists in repo, if branch not found no output else on line is printed

**git ls-remote --tags http://user:pass@github.com:user/repo.git v7_3**

Return code in above 2 cases is 0 always whether branch/tag found or not



标签: git cvs