![]() It may look nicer, but for a tool that is designed to keep history of revisions, it is much cleaner to keep every commit so you can see what happened. Perhaps it should never have been put into git at all, as all it appears to do is prettify the history, something that shouldn't be necessary in any SCM whose single essential job is to preserve history. ![]() Some people consider rebase to be harmful. I think that says it well enough as a reason not to use rebase at all, let alone automatically do it for every pull. To avoid rebasing the upstream in the first place. This section explains how to do the fixįrom the downstream’s point of view. Rebasing (or any other form of rewriting) a branch that others haveīased work on is a bad idea: anyone downstream of it is forced to If you read the git manpage for rebase, it says: why does git checkout -ours get the wrong version of the file? You can always revise your local environment, make aliases, etc. They will go to Google, SO, get cookbook advice and then wonder why some things don't work, e.g. Any time you put Git together with a big group of developers some of the developers won't understand Git all that deeply (myself included). Suggestion: Don't make a policy of changing the default. This scenario avoids some of the situations where a rebase is not good, but usually does not eliminate them. Since he probably decided Git's defaults, this might explain why.Ī lot of people now use Git in a centralized way, where everyone in a small team pulls only from an upstream central repo and pushes to that same remote. If you follow the whole thread you can see that one developer is pulling from another developer and Linus is pulling from both of them. Commiters who do a lot of pulls and have a lot of pull get the default that suits them best.įor evidence of intent, here's a link to a well known email from Linus Torvalds with his views on when they should not rebase.Developers can rebase when they want to.Developers who do not know when it's ok to rebase will merge by default.Git was designed for a large highly distributed team where everyone does not pull and push to a single central repo. If you always rebase then you end up changing shared history, not to mention fun conflict cycles. You may work on features in close collaboration with other developers, pulling from them or from a shared topic branch and still occasionally updated from upstream. Some people do a lot of pulling from downstream, from contributors, etc. You may pull from upstream and from downstream. In a team that is not just using Git for centralized source control. "Rebase every pull." just sounds wrong if you use pull requests or similar. Git cannot presume it is ok to -rebase every pull. It is hard to know for sure why merge is the default without hearing from the person who made that decision. The answers there reflect this, focusing on problems with merge and benefits of rebase. It discusses the merits of rebase over merge, while this question asks about the benefits of merge over rebase. It has been suggested that this question is a duplicate of Why do so many websites prefer “git rebase” over “git merge”? however, that question is somewhat the reverse of this one. So I'm wondering if there is something I'm missing. I am interested in making a case that we should usually rebase in this type of situation (and probably for recommending developers set their global config to rebase by default), but if I were opposed to that, I would certainly be asking why rebase isn't the default if it's so great. The primary motivation for this question is that my company is trying to establish some baseline standards (hopefully, more like guidelines) for how we organize and manage our repositories to make it easier for developers to approach a repository they haven't worked with before. Do we have any insight into why it was chosen? Are there benefits that make it more suitable as a default? ![]() I am just having trouble thinking of reasons why the merge might be preferred for the default. Yes, the hashes of your local commits will get changed, but this seems like a small price to pay for the simpler history you get in return.īy no means am I suggesting that this is somehow a bad or a wrong default, though. ![]() ![]() In my opinion, the rebased version has numerous advantages that mostly center around keeping both your code and the history clean, so I'm a little struck by the fact that git does the merge by default. You can tell pull to do a rebase instead: git pull -rebase If you execute git pull with the default settings, you'll get something like this: The remote repository has new commits that you have not yet reconciled.You have some local commits (commits that have not yet been pushed anywhere). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |