Using git, how to avoid reinstalling and clicking?

I think the only rule about rebase and push is that

After the commits are redirected to the public repo, do not reinstall or click

But is it true that if we use only git push or git push origin <branch-name> and never use the --force or -f flag, then this will never happen?

+4
source share
4 answers

If your public repo is a bare repo (this means you can rebuild something directly on a public repo), and if you set git config receive.denyNonFastForwards and receive.denyDeletes to true, then you should be fine.

If set to true, git-receive-pack reject the ref update, which is not fast. Use this to prevent such an update via push , even if this push is forced .

If set to true, git-receive-pack reject the ref update, which will remove the ref. Use this for to prevent push links from being deleted this way .

See also " Is there a way to configure the git repository to reject ' git push --force '? "

Please note that these settings are not directly accessible to the GitHub repository, for example.

+6
source

It is true (I think) that a remote repo will never be in a “bad” state unless you use --force , so you cannot do this by accident.

But if you recompile the fixes that are already on the remote control, your local repo may be in a state where you cannot press the remote repo without going through any gymnastics that will win at the reinstallation point anyway.

+1
source

Yes. You cannot reinstall, then push the remote tracking branch without using --force.

+1
source

Without the -f flag, this will never happen.
But what would you do with your branch without being able to push it?

Rebase is basically saving your branch history and serial usage history. It's safe when you are the only thing merging into this code, or if you do it only locally.
Otherwise, make sure that you are on the same page with all other participants before rebooting.

+1
source

Source: https://habr.com/ru/post/1432181/


All Articles