2

I pushed go & react codes to github.

Go codes are successfully commited but React codes are not.

React content is created by create-react-app.

article
├ api
│  └ main.go
└ client
   └ React content made by create-react-app

image of github

Here is target github

https://github.com/jpskgc/article

I trid following command, but not solved.

error: the following file has staged content different from both the
file and the HEAD:
    client
(use -f to force removal)
$ git rm --cached client -f
rm 'client'

Also i tried following command, but issue is not solved

$ rm -rf client/.git

contents of client folder is to be commited in github. but actually not committed.

3
  • What's the content of client?
    – Rahul Rana
    Commented Jul 23, 2019 at 11:34
  • Thansk reply. The content is react.
    – jpskgc
    Commented Jul 23, 2019 at 11:41
  • run git status and post the log Commented Jul 23, 2019 at 11:45

3 Answers 3

14

The problem is both directories are git repositories in which case you would have a submodule.
You can see a submodule is added by this commit Subproject commit 395ee793f20a65d483a50cb1d11b67e7f80729d0.
To remove git submodule but keep files follow this instructions.

mv client subfolder_tmp
git submodule deinit client
git rm --cached client
mv subfolder_tmp client
git add client
1
  • 1
    Thansk reply. I already tried $ rm -rf client/.git but this issue occurred.
    – jpskgc
    Commented Jul 23, 2019 at 11:40
1

I might be a bit too late to come to this post. But in case anyone still wondering how to fix it. Here is what worked for me:

// moving to your client folder or whatever 
// the react-app folder is called
cd client
// remove the git in this folder
rm -rf client/.git

Now you go back to you root directory and do the add, commit, and push. You should have all your react-app folder pushed to the repository you want to.

0

In fact, in this case, there may be two separate gitHub configuration files added to each other. If you are working on MacOS ⌘ + ⇧ + . Show hidden files with (cmd + shift + dot). Then delete one of these two git configuration folders.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.