'Is there a force push option in GitHub Desktop?
Using version 1.0.4, I can't find any force push option. Is command line the only way to use force?
Can't push and Can't pull
Solution 1:[1]
As of Nov. 2018, still no native support for a push --force
in GitHub Desktop:
- no mention of that feature in the Release Notes page,
- no mention in the current roadmap,
- issue 3580 was still pending.
That might change, considering GitHub is now displaying who did a push --force
on GitHub.
Update August 2020, issue 3580 mentioned above now include this screenshot, by turtlemaster19:
Interestingly, in the Advanced preferences of GitHub Desktop (at least on Mac) there is this interesting checkbox:
Solution 2:[2]
If you only need to force-push just once, and are familiar with the command line, you could do this:
Open the Github Desktop logs via "Help" > "Show Logs in Finder"
Now perform a Push in Github Desktop
You'll see what command the app is trying to perform in the logs window, e.g.:
[ui] Executing push: git -c credential.helper= -c protocol.version=2 push origin main:main --progress (took 1.441s)
Copy that call to the 'git' CLI and add a --force parameter
Open a Terminal window and navigate to the folder of your local repository
Perform the copied git command, and when asked for credentials, use the Github credentials you've used to login on the website
Solution 3:[3]
After spending some time found force push in Github Desktop Mac, (not sure about Windows)
STEP-1: Switch to history, tab.
STEP-2: Then click and drag one commit over the other. Squash commit popup will come, choose accordingly.
STEP-3: Now you will be able to see force push
Hope this helps, Happy Coding!
Solution 4:[4]
Ran into this same issue, was able to "force" push the changes I made by using the 'upload files' feature on github. Didn't sync my local repo, but it at least got the files in the repo for me to use on another machine. Not the ideal solution I'm sure, but it worked for my purposes, in case it can help someone else.
Solution 5:[5]
GitHub Desktop actually have a force push feature. When you click "History" on Repository page, you can drag a one commit before another one which will cause force push to repository. There is no feature that you have requested at all, but it seems application is on a good way to have such thing.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | Raffael |
Solution 3 | Parthasarathy S |
Solution 4 | AWP |
Solution 5 |