Is it ok when I do rebase and force push in branch which is used only by me? And will I have a problem after merge this branch in master later?
A few situations to illustrate this:
- We have master, I need to add some feature, so:
- git pull origin master
- git checkout -b new_feature
- make some changes inside my branch
- git pull --rebase origin master -- because I don't want to have intermediate merge commit
- if master branch has changes we'll get rebased history of commits in current state
- git push origin new_feature -f -- I'm able to push it only with force because the history is different in current and remote feature branch.
I don't merge it in master in feature, because a merge request is created after that for this branch, so this action is doing by another team member as example.
And I'm absolutely sure that noone commit in my branch and works with my branch, so as I understand force push is acceptable.
- The second situation where I want to squash some commits:
- git pull origin master
- git checkout -b new_feature
- git commit -m "tst1"
- git push origin new_feature
- git commit -m "tst2"
- git rebase -i HEAD~2 After rebase
- git push origin new_feature -f
And after that merge request in gitlab and merge in master.