Reputation: 777
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
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.
Upvotes: 2
Views: 5752
Reputation: 986
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.
Upvotes: 0
Reputation: 11
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.
Upvotes: 1
Reputation: 3748
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
Upvotes: 14