Exact equivalent svn export command for git?

No exact svn export equivalent command for git? Really?

Beware: this is not a duplicate question. That is, I already know and checked these commands:

  • git clone --depth 1 <- Still loading the .git folder.
  • git checkout-init <- Does not work for remote repo, it works with a working copy (so you need to clone first).
  • git archive <- This would be an ideal solution because it has the --remote argument, but has only two possible formats: tar or zip, so I will need to unzip / unzip after loading, and for that I need a pipe (|), but I'm on the windows! (not * n? x)
  • git clone --bare <- I still don’t know what it is, but that’s not what I need.

Please enlighten me, is there a real replacement for svn export in git?

+6
source share
7 answers

In some hostings, such as GitHub, you can do the exact svn export .

Example:

 svn export https://github.com/GNOME/banshee/branches/master 

Even partial! (some part of the repository)

Example:

 svn export https://github.com/liferay/liferay-portal/branches/6.1.x/tools 

For your own repository, you must create some GitHub repository and add it as a remote:

 git remote add github https://github.com/<user>/<repo>.git 

then

 git push github <branch> 

Now you can perform a partial check as described above.

+4
source

From How to make a quick clone without changing the story? :

 git clone --depth 1 your_repo_url 

Then from the rmdir documentation :

 rd /s /q .git 
+13
source

Question: "How can I export svn style using git?" "How can I change tires on basketball?" You cannot, but this is not a basketball mistake. Yes, it's rubber and full of air, but the similarities end there.

You only need to “export” using svn, because it pollutes every single subdirectory using the .svn directory. Git does not do this, so you really don't need it. A clone is an export, with only one directory in the root directory in which the entire repository lives.

The easiest way is to clone the repo and then just delete the .git directory from the top level of the repo. Do it and it’s not a repo anymore, it’s just an offline file directory.

Or, you know, ignore Git all together and just use the cloned files. This also works.

+12
source

Just get rid of the repository in your working copy.

 git clone remote rm -Rf .git 

(On Windows, it's rd /s /q . Thanks for the @Bruno hint.)

+9
source

For you, I still don't know what it is: git clone --bare will clone the repository without a working copy. This is usually done in a central repository in order to minimize disk usage.

Bruno / King Crunch has the best answer. Although you can use git bash / cygwin so you can connect if you need a single liner.

+3
source

True, git archive <- That would be the perfect solution ... but it has only two possible formats: tar or zip , you can add new formats using the documentation from the EXAMPLES section of the git-archive(1) page:

  git config tar.tar.xz.command "xz -c" Configure a "tar.xz" format for making LZMA-compressed tarfiles. You can use it specifying --format=tar.xz, or by creating an output file like -o foo.tar.xz. 

While “on windows” is usually considered an obstacle to many tasks, with a little extra work, you can almost catch up with people running other operating systems using software such as Cygwin or the MKS Toolkit .

If, after confirming that any command you need is accessible from within your shell, this git config … command still doesn't work for you, then you should probably post more information about your configuration in the SuperUser.com question.

0
source

From fooobar.com/questions/374 / ...

 git checkout-index -a -f --prefix=/destination/path/ 
-1
source

Source: https://habr.com/ru/post/891746/


All Articles