You will need to use Git push -force to make it work. Git will detect the history mismatch and will reject the push. Rewriting history when pushing to a remote repository can be a problem. Why You Should Not Use Git Rebase (Drawbacks) A fast-forward merge also provides more confidence that the code will still work after the merge, as the code will be identical before and after the merge. Rebasing can also ensure a fast-forward merge which is essential in the Git Flow workflow. Doing this makes maintaining a clean history easier. Rebasing allows you to modify your commits and commit messages with squash, fixup, or other commands. If you are committing as often as you should, you may end up with some wacky Git commit messages on your feature branch. ![]() This can prove valuable later in the event you are trying to uncover a bug using Git bisect. Using Git rebase will ensure your project maintains a clean, linear project history. Other people may have a copy of the history, and they will have no easy way of resolving the inevitable conflicts if you Git rebase at this point. It is generally never ok to rebase a public branch. A conflict may still occur, but close communication will make it easy to see changes and resolve any issues. It is often ok to rebase a feature branch that is shared with a small team of developers communicating closely. This is because you have the only copy of the history, and nobody else is depending on it. Generally speaking, rebasing is a viable option if the branch you are working on is not published to a remote server. If you are one developer working in a private Git branch or private repository, using Git rebase is perfectly acceptable. You may have heard before that rebasing is dangerous and a bad idea. That's a 'destroy history'." - Linus Torvalds "People can (and probably should) rebase their _private_ trees (their own work). It does this by moving the main branch point to the feature branch pointer without an additional merge commit.
0 Comments
Leave a Reply. |