What's the difference between a button click and a normal git button click

I want to know what is the difference between a power push and a normal push, and in what situations should I do a power push in git? Is it good practice to push the master branch?

+3


source to share


2 answers


You only force-push when you need to replace the deleted history with your local history.

This happens when you rewrite local history, usually viagit rebase

.
For example, if you just pushed the wrong commit and changed it locally, using it push --force

might help fix the recent push

If you are the only one in the industry you click on it, it doesn't really matter.
If you are not the only one, then you need to communicate clearly so that other users reset to have their own local branch on the new remote computer. Or, you need to avoid the forced push in the first place.



Is it good practice to force push to the master branch?

This is generally not a good practice (again, unless you are using a remote repo).
And don't forget that after the branch has been pushed ... you may not know who didpush --force

.

+5


source


Force-pushing is a very threatening and risky technique if you are working on a shared repository. With this power, you can force your local revision of the remote repository.



But pushing hard on a remote repo is not good practice. You can use normal push and resolve conflicts between commits, if any.

0


source







All Articles