Directories within a project

Hi, I’m new to gitlab and I have everything setup on my computer and on the website. I can’t push to a project I created on the website. I may be going about this the wrong way though. It’s telling me the histories don’t match, even after I do a pull to sync the repository? But I haven’t uploaded anything to the server yet so of course they don’t match. What I’m trying to do is have a project that has multiple files. Each file is a separate module within the project as a whole, and I’d like to be able to push to those folders individually, as if they were their own sub-project. I can’t seem to create a project within a project so what approach should I be taking for this?

Anything you create on the website, you need to start by PULLING to your computer, to get a copy of the history up to that point. Then, you can add commits that create new files, new directories, whatever and push them back to gitlab. But if you’re creating things on your computer that don’t use the previous gitlab history as a starting point, you can’t push those changes “back” to gitlab because (since they never came from there) there’s no reference point to use in comparing the two states.

(Pulling from gitlab starts with cloning the remote repo, the first time. And then you can pull updates whenever’s necessary.)

1 Like

If you have changes in a local git repo that isn’t a clone of your gitlab repo, and you want to incorporate those, the way to go about it would be to clone the gitlab repo to a different directory, and then either copy the changed files in and commit them to the cloned repo, where they’ll be pushable back to upstream, or if you want to preserve commit history, you can use git format-patch to write out patch files for the commits, then apply them in the gitlab clone.

1 Like