UnseededAndroid
UnseededAndroid

Reputation: 567

Push multiple folders to a repo

How do I add 2 different folders without the same parent folder into 1 repo?

Basically, I wrote a bunch of code snippets in Haskell and pushed that to the repo.

Now I'm writing Go snippets, and its in a completely different folder on my harddrive. How do I link that to the same repo, so I can push it and keep things organized? Currrently, when I try to push git is telling me to fetch first. But if I do that, I'll basically have 2 copies of my repo on my harddrive.

Upvotes: 1

Views: 353

Answers (1)

VonC
VonC

Reputation: 1329082

From your first folder (which is a local git repo, and has been pushed), you can do:

git --work-tree=/path/to/second/folder add .

# in case a git status shows haskell files deleted:
git reset *.hs

git commit -m "Add go files"
git push

Upvotes: 1

Related Questions