I am getting into the GIT world, but it seems like GIT has a huge disadvantage.
Because your are submitting to your own local repository and only after several submissions your are submitting to the outside world, doesn’t it creates many big merges?
I am getting into the GIT world, but it seems like GIT has a
Share
Really, there’s a way around merges in almost all cases in git. Instead of merging, you rebase your local repository, re-arranging history. By using rebase, the canonical/origin repository is never re-arranged and rarely has any merge commits, but local repository histories are re-arranged to more closely match the main repo.
So:
And all commits will be atomic, and the origin/master will never have any merge commits.
Now, in a rare rare case the rebasing process will become complicated and you’ll find yourself resolving a lot of conflicts, in which case you may want to
git rebase --abortand back out of the rebase process and then go for a merge instead, but I’ve gone months without needing to resort to a merge at this point, so keeping the history linear isn’t too hard.Essentially what this is doing is taking the least destructive approach. You are saying “hey, all of my commits are ones that I added to my local master branch -after- whatever other people put in the central/canonical branch are my responsibility, so -I- will be the one to re-arrange my code.” In this manner, whatever goes into the master branch of whatever repository is deemed canonical FIRST gets precedence, and other people do not have to deal with merge commits that rewrite history for anything that is successfully pushed to the master branch.