We are checking out git and would like to understand which workflow might suit our small team (4 developers).
Some details about what we do:
What is a "typical" git workflow for a team such as ours?
I would like to spend as minimal time as needed on "administrative" operations as possible.
For example, today we have seen that a git push request by a developer fails since another push was made before, and he had to merge changes locally using git pull first.
Is a typical scenario going like this:
Developer, commit locally. Pull from git repository. Push into git repository.
Can we not skip the pull? (have the merge done on the remote server?)
Currentlly we are using ClearCase, and this is resolved by merging during the push ("commit") operation without the need to pull first.
First, I would recommend at least two branches. We call ours master and integration. Master is the current stable production-ready code base. This is what's either in the customer's hand or about to be submitted to the App Store (we're an iOS shop). Integration is where we store our test-ready code. If someone asks for a test build, this is what we give them. Code here compiles and runs, but isn't perfect. Depending on your deployment and testing process you can have as many additional branches as you need. Branches in git are easy and fast, there's no reason to not have as many as you need.
Here's how our process works:
git pull to get the latest version of integration on their machine.git pull to make sure you've got the latest commit.git merge --squash fix-home-page will pull in your branch in one nice clean commit and keep your history linear.git push to shove your fixes back up to the main repo.I like git merge --squash because it greatly reduces the number of conflicts. Other people like to use rebase, which will also give you a linear history and preserve all the commits from your topic branch. Use whatever suits you.
Finally, to answer your question: Yes, you have to do a git pull before pushing. Git is great about resolving conflicts, but if it can't resolve the conflict then you need human intervention to figure out what should be happening.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With