Just wanted to share the following with others since it is in response to a yammer post within my organization. Maybe it will be slightly helpful to others. I do realize I am leaving a large part of the thread out of this. Hopefully I will be able to come back later and actually post our Git workflow.
———–
Git does allow a lot of flexibility in setting up a workflow. It is essential to understand the workflow possibilities and tweak that to fit the organization. Steven has a good point that it is possible to push such that you re-write history. While this is allowed, it can easily be turned off and set by access permissions and/or server side hooks. This is controlled and managed using Gerrit for our team. That way only a limited number of people have the ability to force change history.
There was mention of using “rebase” to change the workflow. From my experience, this has improved the workflow in Git. Our team has “rebase = always” setup so that anyone making a branch will automatically get it setup to be rebased onto the latest code. When anyone sets up a Git repo they run a small setup script that does the aforementioned and some additional tweaks for our workflow. A benefit that you get with using rebase is that your git history is much easier to read since you are really committing only fast-forward changes (less actual merge commits – kind of to John’s point). Since we push everything through Gerrit, developers have the opportunity to do a code review, check their changes, and copy anyone on the change *before* it gets committed to the active development stream.
I am trying to setup gerrit and git, and I am almost there. I see the list of projects in gerrit that are indeed my repositories, but I have no idea how to setup the remote in my clone so I can send the commits to the gerrit repos.
I don’t seem to have gerrit repos even though I have projects. How can I get my existing git repositories into gerrit?
I assume you used the ssh command that creates the git repositories? Like: ssh -p 29418 review.example.com gerrit create-project –name new/project. This will make a physical git repository under your specific gerrit.basePath. You should be able to push or pull from this immediately after creating the repository as long as you have setup the correct permissions for push/pull privileges. Hopefully that makes sense. If not, just comment back and let me know.
Thanks for responding. I didn’t use that command because I am using the latest version which says not to run that if you import the git repositories during init, which I did. I see all of the git repo names in projects, but there is nothing under them. When I click on branches it says no git repository. Also, if I were to use that command, what do I replace review.example.com with? My web page is accessible via http://servername:8080. Once I have git setup in gerrit, how do I add the remote to my clone? I am not sure what the url is for the gerrit repos. So glad to get some help here. You are the only person who seems to be reading my questions. 🙂
Marlene