7 ways to make Git work better for your team
2 min read hello world gitThis article is a continuation of my git workflow.
As your teams grow or shrink, there are practices that you can do with git that can make knowledge transfer more comfortable. Here is a list of things that you can do to make that process easier.
- Branch from master
- Only keep branches that are actively worked on
- Branches should be relatively short-lived
- Merge master to your branch regularly if it exists longer than a few days. Doing this helps to avoid merge conflicts later
- Periodically remove branches that have been merged to master. Automate it if you can
- If your branch is related to work tracked in a system (Jira, Monday, etc.), consider including that system number along with the human-friendly description
- Use pull requests when merging branches to master to share knowledge with team members. And perhaps catch something overlooked.
Below are some git commands to help make these things easier.
| Description | Command |
|---|---|
| branch from master | git checkout master; git checkout -b jira-1234-something-awesome |
| merge master to your branch | git checkout jira-1234-something-awesome; git fetch --all; git merge master |
| Removing branches merged to master | See my git workflow post |
| Submit Pull request | hub pull-request -r codeninja,techgoddes -b master |
Additional Notes
- The hub-pull request line is because I use the hub tool provided by Github.
- The
-bis unnecessary on the hub pull request for this use case. I offer it here to demo how you could submit a pull request to another a branch by name - None of this is written in stone. Pick and choose what works for you
comments powered by Disqus