git push force
See original GitHub issueSo now from #129 I have function that restore git repo from HEAD~1
but when I have pushed the commit I to update remote I need to use git push -f
.
if this is how push works every time then I need to a way to check if push will overwrite commits so I would be able to reject it when user don’t use force.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:6 (5 by maintainers)
Top Results From Across the Web
How do I properly force a Git push? - Stack Overflow
git push --force overwrites the remote branch, while git push --force-with-lease only overwrites the remote branch if your local copy is aware ...
Read more >How to force push in Git | Learn Version Control with Git
The --force option for git push allows you to override this rule: the commit history on the remote will be forcefully overwritten with...
Read more >git-push Documentation - Git
To force a push to only one branch, use a + in front of the refspec to push (e.g git push origin +master...
Read more >What is the git push --force -u origin command? - Educative.io
The git push --force -u origin command uploads content from a local repository to a remote repository. Normally, Git only allows changes to...
Read more >git push --force and how to deal with it - Evil Martians
GitHub and GitLab have a feature called “protected branches.” We can mark master , develop , stable , or any other crucial branches...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
🎉 This issue has been resolved in version 0.24.0 🎉
The release is available on:
Your semantic-release bot 📦🚀
A deep search of the git source code reveals that
git push -f
is a client side implementation detail. So yes, we must check that what we are pushing follows the 4 rules laid out in the comment ourselves before doing a push:which, written another way, I think ends up being:
Require
--force
for a push if: