So, this is what we do: clone the remote repository This allows us to logically structure our commits on master, even if they're a little messy on our branches. ( Note: This is controversial, see below.) This allows us to turn our entire feature branch into a single commit on master. In fact, our workflow is a little different, as we tend to do squash merges instead of raw merges. In other words, this is what we do and it works: clone the remote repository It turns out that the original workflow is correct, at least in our case. This seems to be a very popular question, so I thought I'd update with my two years experience since I first asked. What is the "correct" workflow for something like this? Git is supposed to make branching and merging super-easy, and I'm just not seeing it. It took me a day to sort everything out, and eventually culminated in a forced push to the remote master, since my local master has all conflicts resolved, but the remote one still wasn't happy. There were tons of conflicts with things that should have not mattered. I've even perused the new Pragmatic Programming book on Git, and they cover merge extensively and barely mention rebase.Īnyway, I was following my workflow on a recent branch, and when I tried to merge it back to master, it all went to hell. My gut feeling is that what I'm trying to do is not an advanced setup, so rebase should be unnecessary. My reasoning for the merge instead of rebase is that merge seems to be standard and rebase seems to be an advanced feature. Therefore, I hate to have code on my laptop that's not mirrored somewhere else. Our repository is automatically backed up and can be restored if something goes wrong. My reasoning for the remote branch is that I want my work backed up as I'm working. There are two essential differences (I think): I use merge always instead of rebasing, and I push my feature branch (and my feature branch commits) to the remote repository. finish my_new_feature, push to origin/my_new_feature Git merge master (to get some changes that my partner added) work, commit, push to origin/my_new_feature Git checkout -b -track my_new_feature origin/my_new_feature Here is the workflow that I started with clone remote repositoryĬreate my_new_feature branch on remote repository Important to note is that the branch always stays local. For example, here's the workflow that he's laid down: clone the remote repositoryĮssentially, create a feature branch, ALWAYS rebase from master to the branch, and merge from the branch back to master. My partner tells me that my problems stem from my desire to merge willy-nilly, and that I should be using rebase instead of merge in many situations. Now, I'm used to that from SVN, but it seems to me that I just traded one sub-par versioning system for another. Sure, branching is dead simple, but when I try to merge, everything goes all to hell. I have heard that Git is excellent for branching and merging, and so far, I just don't see it. I have several years of experience with SVN, so I guess I bring a lot of baggage to the relationship. I've been using Git now for a couple of months on a project with one other developer.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |