Version Control Flow
Git
We use Git for version control. Git is a distributed version control system. It is a tool that allows you to track changes to a file or set of files over time. It allows you to revert back to a previous version of your code, compare changes over time, and see who last modified something that might be causing a problem.
Version control allows us to collaborate with other developers. It allows us to work on the same codebase at the same time. It allows us to work on different features at the same time. It allows us to work on different versions of the same codebase at the same time.
To understand more about Git, read the Git Handbook (opens in a new tab).
In chapter 1.2. we will learn more about branching strategies. In 1.3 we will explore merging and merge issues / conflicts. In 1.4 you can find a cheat sheet for Git commands.
Git Workflow
This guide uses 'dev' as the default branch, but you can use 'master' or 'main' as well. The important thing is to be consistent.
- Check out 'dev' branch using
git checkout devand pull the latest changes usinggit pull - Create a feature branch using the (JIRA) ticket code, e.g.
git checkout -b ALPHA-123/work-on-stuff - Write code until it's buildable
- Time to commit. Use
git add .to add all files to staging area - Use
git commit -m "message"to commit changes- Message should be short and descriptive
- Use present tense
- Use imperative mood
- Finish the sentence "This commit will ..." e.g. "Fix bug #123"
- Merge
devto your branch regularly to get the latest changes and to make sure there are no conflicts - Use
git pushto push changes to remote repository - Create a pull request on GitHub and assign a reviewer
- Reviewer will review the code and merge it to master