josh-project / josh

Just One Single History
https://josh-project.github.io/josh/
MIT License
1.48k stars 55 forks source link

support force-push #629

Open LMG opened 2 years ago

bjeanes commented 2 months ago

I am not sure what you mean by this, but if you mean "force pushing to the upstream", I am pretty sure git push -o force does this, based on my own experimentation:

❯ git push -f $josh/$monorepo HEAD:main
Enumerating objects: 111384, done.
Counting objects: 100% (111384/111384), done.
Delta compression using up to 16 threads
Compressing objects: 100% (25583/25583), done.
Writing objects: 100% (111384/111384), 59.18 MiB | 347.00 KiB/s, done.
Total 111384 (delta 71257), reused 110426 (delta 70723), pack-reused 0 (from 0)
remote: Resolving deltas: 100% (71257/71257), done.
remote: josh-proxy: pre-receive hook
remote: upstream: response status: 500 Internal Server Error
remote: upstream: response body:
remote: 
remote: To To http://REDACTED.git
remote:  ! [rejected]                JOSH_PUSH -> main (non-fast-forward)
remote: error: failed to push some refs to 'http://REDACTED.git'
remote: hint: Updates were rejected because a pushed branch tip is behind its remote
remote: hint: counterpart. If you want to integrate the remote changes, use 'git pull'
remote: hint: before pushing again.
remote: hint: See the 'Note about fast-forwards' in 'git push --help' for details.
remote: error: hook declined to update refs/heads/main
To http://REDACTED.git
 ! [remote rejected]     HEAD -> main (hook declined)
error: failed to push some refs to 'http://REDACTED.git'

❯ git push -o force -f $josh/$monorepo HEAD:main
Enumerating objects: 111384, done.
Counting objects: 100% (111384/111384), done.
Delta compression using up to 16 threads
Compressing objects: 100% (25583/25583), done.
Writing objects: 100% (111384/111384), 59.18 MiB | 315.00 KiB/s, done.
Total 111384 (delta 71259), reused 110425 (delta 70723), pack-reused 0 (from 0)
remote: Resolving deltas: 100% (71259/71259), done.
remote: josh-proxy: pre-receive hook
remote: upstream: response status: 200 OK
remote: upstream: response body:
remote: 
remote: To http://REDACTED.git
remote:  + 6315a5cd552...1b3fe400b5c JOSH_PUSH -> main (forced update)
remote: REWRITE(16cc7b431470e1d929ea3f7ef63930d894b436f9 -> 1b3fe400b5c86bfbe8d263ecff3272f307ae9b52)
To To http://REDACTED.git
 + 6315a5cd5...16cc7b431 HEAD -> main (forced update)