Is it safe to use always git pull rebase?
With the team we are working with git and unfortunately everyone on master. The problem is that everyone is also using default git pull, which quite often leads to "Merge branch..." and sometimes it contains too much files... So I read that to avoid those merges it would be better to use git pull --rebase
, but is it safe in this case? Everyone will be doing commit
, then git pull --rebase
, then the files from remote will be taken at the top of HEAD and the commit on top of it.
So in this situation if someone modified the same file as me, after this steps I will see the conflict and would be able to resolve it and commit again and then there will not be a "Merge branch..." with files with someone else push, right?
So I read that to avoid those merges it would be better to use git pull --rebase, but is it safe in this case?
Yes, its safe to use git pull --rebase
.
You should check the git workflow. It's not encouraged for a team to work directly on the master, commit and push. Create a branch and the merge to the master and then pull/push the master to the origin.
@Patrick Trentin already provided the link to the questions that can help you to understand the usage of git pull --rebase
.
Useful links
上一篇: 在Vim中删除换行符