How to paste a directory into a git repository

1.6k views Asked by At

So I have a git repo and I'm trying to paste a directory into it. I clone the repo, checkout a new branch and paste the directory in one of the sub directories. So the file path is like this

Repo/ios/parentDir/directoryPastedIn

When I'm in the parentDir and I do a git branch, I see that I'm on the branch that I checked out. When I'm in directoryPastedIn, I do a git branch and see that I'm on master, instead of that branch.

When I do a git status while I'm in the parent Dir I get this(after I've done a git add -A) -

# On branch someBranch
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#   new file:   directoryPastedIn
#
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#   (commit or discard the untracked or modified content in submodules)
#
#   modified:   directoryPastedIn (modified content)
#

However, when I go into the directoryPastedIn and go into some of it's sub directories and do a git status, I see that there are untracked files. When I push this to the remote, I see that a binary file has been pushed, rather than a directory.

So how do I paste in a directory into my local git repo and push it?

1

There are 1 answers

0
Klas Mellbourn On BEST ANSWER

It sounds to me like you have pasted in a directory that itself includes a git repository.

Check to see if the pasted directory has a .git subfolder. If so, and if you don't want that repository, remove that.git folder.