Implementation - Source Control Systems Flashcards
Source Control Systems
What is the git work flow?
Clone/initialize a repo (git clone/git init)
Edit/add files to the project
Add the changed files to the staging area (git add)
Commit the changes to the repository (git commit, then git push to push it to GitHub Etc.)
Go back to step 2 and repeat.
What is branching?
Its common practice to create a new branch whenever you start work on a new feature (or user story), then merge back into the main/master branch when you’re finished
What is the GitHub branched based workflow?
Create a new branch so any new ideas don’t affect the main/master branch. (If it isn’t deployable, it shouldn’t be in main)
Make some commits to this new branch as this featured is worked on
Make a pull request to the main branch when the feature is finished. This initiates a discussion with the rest of your team about your commits.
Discuss and review your code is your change missing unit tests? Coding style? Does it match project guidelines?
Merge into main! Once your pull request has been reviewed and the branch passes your tests, you can deploy your changes to verify them in production. Often teams have a specially provisioned test environment that I s deployed to first.
What is merging?
Git will then merge the changes automatically (most of the time)
Sometimes a merge conflict occurs (e.g. when two developers have changed the same file)
What is a .gitignore file for?
A .gitignore specifies files that git should ignore
These should include files you don’t need/want in your repo, including:
Dependency caches (nodes modules is a notorious example)
Complied code
Files generated at runtime
Personal IDE config files (like .idea/workspace.xml)
What are the useful features of version control?
if a feature is added that breaks all the code
You can rollback to a previous version that compiles and passes all tests.
Then try again with the new feature.
Each committed revision gives you a rollback position
What are some good tips for source control management?
If it’s not in source control, it doesn’t exist
Commit early, commit often
Always inspect your changes before committing
Consider your teammates when writing commit messages
Should we version our database (or files)?
Many applications will not run without their database.
If you’re not versioning the database, what you end up with is an incomplete picture of the application, which in practice is rendered entirely useless.