Crista23
Crista23

Reputation: 3243

Pushing to git a folder downloaded with svn export

I have downloaded a specific folder of a git repository using svn export:

 svn export https://github.com/user/repo.git/trunk/doc/myFolder

Now I have myFolder folder locally, but after making changes I want to push it to the git repo in the same directory from where I have downloaded it. I also need to include a .gitignore file with the list of files not to be included.

Currently if I type git status inside the downloaded folder it says

fatal: Not a git repository (or any of the parent directories): .git

I want that when I push to the repo the files in the folder on git will get replaced with my local version. How can I do this? Thanks!

Upvotes: 0

Views: 51

Answers (1)

janos
janos

Reputation: 124648

The result of an svn export command is a simple directory tree without any version control data. You cannot commit in it, not with git, not even with svn. svn export is only suitable if you want to read files of a sub-directory and never intend to commit and push back.

If you want to work with the repository, make changes and push back, you can use the --depth option of git clone. It takes an integer parameter, and it will clone only the specified number of recent commits of a single branch. It will get all the files of the latest revision, you cannot filter to a specific sub-directory only. So it's not exactly what you want to do, but hey, no pain no gain.

Upvotes: 1

Related Questions