Reputation: 5387
I have an old project on bitbucket. I've recently worked on a local folder and totally restructured and edited the project. Now I discovered that this local folder was not cloned... How do I push this to replace the repository>
I did git init to create an empty repository. If I clone the remote repo then my local changes will be overwritten right?
I suppose I need to do two things:
Any ideas?
Upvotes: 0
Views: 45
Reputation: 5709
So you have your initial commit in local repo, all other changes uncommited and you want to replace origin with your local changes, right? If you don't want to overwrite bitbucket history, you can:
git checkout -b your_branch
git add ./*
and git commit
git chekout master
(assuming your master is in sync with bitbucket master)git merge your_branch
Upvotes: 0
Reputation: 11595
cd /path/to/not_cloned/folder
git init
git remote add origin BITBUCKET_URL
git fetch
git reset --soft origin/master # This will move your current 'master' branch to the same commit as 'origin/master'
git status
# You should see all files from repository as deleted and all new files as untracked
git add .
git commit --message "New structure"
git push origin master
Upvotes: 1
Reputation: 5387
I think I fixed this by:
adding repo:
git init
git remote set-url origin [email protected]:username/project.git
(note: use set-url, not add as it already existed at some point)
Then adding files
git add ./*
git commit
git push --force -u origin master
Upvotes: 0