Reputation: 4778
So I have just started collaborating with someone using a git repository. We are pretty new to using git but understand the basics and have devised this workflow for the two of us.
3 branches: Master, User1, User2
We work separately on user1 or user2, and then when we complete the small task that we are working on individually we merge it back to the master branch and resolve any conflicts that there might be.
My question is, after one of us merges with master and resolve conflicts in master, what is the best way to make our respective user branch match master? Just close the branch and checkout a new one?
Also if there are any improvements to our workflow, advice would be greatly appreciated. Trying to get a full understanding of git, Thanks.
Upvotes: 0
Views: 72
Reputation: 2362
You can always recreate your branch and start a new one based off of master
. This is one of the cool things about git, that branches are cheap so you can make/delete as many as you want. I prefer doing something like this rather than maintaining long-running branches.
Another option is to rebase
your branch onto master any time there are new commits in master. Rebasing is a concept that took me a little bit of time to grasp fully and it has a pitfall or two if not used properly, so read up before attempting this. It's very cool though!
My workflow for most projects typically involves just one branch, master
. I do my work in "topic" branches, meaning I create a new branch for every distinct task I'm working on. When I'm done with that task I can merge it to master
and then push so that other people can get those changes. I can then delete my topic branch safely.
If you're just starting out with git, this is a great resource: http://git-scm.com/book
Upvotes: 1