Just do:
git push origin <your_branch_name> --force
or if you have a specific repo:
git push https://git.... --force
This will delete your previous commit(s) and push your current one.
It may not be proper, but if anyone stumbles upon this page, thought they might want a simple solution…
Short flag
Also note that -f
is short for --force
, so
git push origin <your_branch_name> -f
will also work.
Related Contents:
- What are the differences between “git commit” and “git push”?
- What does ‘–set-upstream’ do?
- Heroku: How to push different local Git branches to Heroku/master
- How to push to a non-bare Git repository?
- fatal: ‘origin’ does not appear to be a git repository
- git push heroku master says “Everything up-to-date”, but the app is not current
- git push >> fatal: no configured push destination
- Git push to live server
- What are the consequences of using receive.denyCurrentBranch in Git?
- When doing a ‘git push’, what does ‘–set-upstream’ do?
- How do I delete a Git branch locally and remotely?
- Is there a way to cache https credentials for pushing commits?
- Git push requires username and password
- Undoing a ‘git push’
- Git Push ERROR: Repository not found
- git push –force-with-lease vs. –force
- How do I avoid the specification of the username and password at every git push?
- Git – What is the difference between push.default “matching” and “simple”
- Changing the Git remote ‘push to’ default
- rejected master -> master (non-fast-forward)
- What does “Auto packing the repository for optimum performance” mean?
- How can I push a local Git branch to a remote with a different name easily?
- How can I find the location of origin/master in git, and how do I change it?
- Why does Git tell me “No such remote ‘origin'” when I try to push to origin?
- How do I fix “remote: fatal error in commit_refs” errors trying to push with Git?
- Issue pushing new code in Github
- ! [rejected] master -> master (fetch first)
- Git push rejected “non-fast-forward”
- Cannot push to Heroku because key fingerprint
- Push git changes to a shared network drive
- How can I automatically push after committing in Git?
- How can I automatically deploy my app after a git push ( GitHub and node.js)?
- Git says local branch is behind remote branch, but it’s not
- How can I remove all files in my git repo and update/push from my local git repo?
- Push a commit in two branches with Git
- How to convert a readonly git clone from github to a forked one
- When I do “git push”, what do the statistics mean? (Total, delta, etc.)
- Git warning: push.default is unset; its implicit value is changing
- git push rejected
- GitHub – error: failed to push some refs to ‘git@github.com:myrepo.git’
- Do you push every single commit? [closed]
- Git prevents pushing after amending a commit
- Git error: src refspec master does not match any error: failed to push some refs [duplicate]
- Push branches to Git
- Elegant solution to prevent force push on master only
- Why is `git push –force-with-lease` failing with “rejected … stale info” even when my local repo is up to date with remote?
- git push to remote branch
- How to push a single file in a subdirectory to Github (not master)
- Broken pipe when pushing to git repository
- What does GIT PUSH do exactly?