I am separating one git repo into 3. I've used Detach (move) subdirectory into separate Git repository to separate folder and pushed them successfully to new git repos. On the existing repo, I've used the following command to clear out the moved directories.
git filter-branch -f --index-filter "git rm -q -r -f --cached --ignore-unmatch lib/xxx/$REPO" --prune-empty HEAD
Now when I do git st
on the original repo, I get :
# On branch 1.5.0
nothing to commit (working directory clean)
When i try to git push
, I get:
! [rejected] 1.5.0 -> 1.5.0 (non-fast-forward)
error: failed to push some refs to 'git@github.com:/xxx/.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.
My guess is to use -f : git push -f origin <branch>
but I wish to make sure since this is going to modify my existing repo.