user1858027
user1858027

Reputation: 1007

Not able to add folders to with git on bitbucket

I cloned few repo from the github into my current working direcory. I forgot to delete the .git folder in their folder and i commited the changes.

Then i delete the .git folders inside them and again hit commit.

Now in my bitbucket account they are coming as greyout in grey color like this. I can't click on them

demo_test1 → 3608f1e44d[36044c82d]
demo_test2 → 8cc44a089[8cc4a089]

All the files are still there in my local folders but not in bitbucket.

IF i hit commit it says no changes but files are still there.

what should i do

Upvotes: 1

Views: 4786

Answers (1)

VonC
VonC

Reputation: 1323203

You could reset your HEAD and index back to before you added your nested repos:

git reset SHA1_before_first_commit_with_nest_git_repos
git add . 
git commit -m "nested repos clones"
git push -f

The git reset won't affect your current working directory (so your files remains untouched, and your nested repos, without their .git folder that you just removed, are still there).
After the reset, you can add all those files again, and force push that new commit back to BitBucket.

If you don't have many collaborator on that BitBucket repo, forcing the push (ie, replacing the published history by a new one), won't be a problem.

Upvotes: 4

Related Questions