4 ms·
Better yet, don’t use push —force at all unless you specifically intend to undo commits on the remote. Resolve conflicts locally and never force push to a share
by fcarraldo 8y ago
Better yet, don’t use push —force at all unless you specifically intend to undo commits on the remote. Resolve conflicts locally and never force push to a shared branch.
- jeremyjh 8y agoThis forces you to merge master into your shared topic branches instead of rebasing them on master, which makes the history harder to follow.
- u801e 8y agoYou can always run something like: git diff origin/your-branch..your-branch to check whether you have made any unintentional changes to the code. For the commits themselves, you can do something like: git log origin/master..origin/your-branch and git log origin/master..your-branch to see if the commits differ. You can use the -p switch on the git log commands to see if the diffs have changed. If you do this before pushing up to the remote, then it's much easier to see what you're going to change before you run git push -f.
- pjc50 8y agoCould you explain this and why it requires --force? (One of the features of git that I struggle to understand isn't a deal-killer for its adoption is the lack of repo access control; if you want this you have to implement it manually through PRs)