In the last episode, I showed you how you can view the changes in each of the commits in the GitHub UI. But you can view differences in the command line too using git diff.
Labs
Labs are hands-on coding projects that you build along with Tonya as she explains the code, concepts, and thought processes behind it. You can use the labs to further your code knowledge or to use right in your projects. Each lab ties into the Docx to ensure you have the information you need.
Each lab is designed to further your understanding and mastery of code. You learn more about how to think about its construction, quality, maintainability, programmatic and logical thought, and problem-solving. While you may be building a specific thing, Tonya presents the why of it to make it adaptable far beyond that specific implementation, thereby giving you the means to make it your own, in any context.
Git Init – Put New Project into Version Control
When you have a new project, how do you put it into version control? You navigate to the root folder of the project, i.e. the theme or plugin, and run the command git init. Git then installs a new hidden folder inside of your project. That folder has what git needs to track that individual project. In this episode, you’ll put the TwentySeventeen theme into version control and then look inside of its hidden .git folder.
Contributor’s Workflow Big Picture
When you contribute or join a project team, your workflow needs to change. In this episode, I’ll walk you through the big picture of a contributor’s workflow. Then in the rest of this hands-on coding lab, you and I will walk through each of the steps of how to make a copy, branching, keeping your code up-to-date with the original repository, making a pull request, and more.
Code Review & Change Requests
You’ve opened a pull request (PR). Let’s walk through a typical code review process. You’ll request 2 changes. Then you’ll walk through making the changes and pushing them to GitHub for further review. Let’s do this together.
Wrap it Up
Let’s review everything you did in this lab. Then I’m going to challenge you to contribute. Finally, share this lab with others whether on social media, at meetups, or at work. If this lab helped you, share it with your peers.
Keep Your Branch Up-to-Date
When you are working in a branch, it’s likely that the develop branch will get new PRs merged into it. When that happens, you might need those changes in your branch in order to complete your work and/or avoid a merge conflict. There are several strategies for keeping your branch up-to-date: Do nothing – when there are no changes that impact you Merge update strategy Rebase update strategy The project or team sets the branching and update strategy. It’s important that you know which strategy they use and then follow it.
Open a Pull Request
It’s time to open a Pull Request (PR) in order to submit your contribution for consideration. Let’s walk through the process and do it together. You’ll also walk through the GitHub interface and explore discussion options, tagging, and code comparisons.
Add More Changes to Last Commit
What if you made a commit and then realized that you forgot to make one more change? Imagine that you’d like that change to be packaged up with the last commit, as it all goes together. You could do another commit. But instead, you can amend your last commit and add the new changes to it. Let’s do it together.
Fix the Last Commit Message
What if you made a typo or forgot to add something in the last commit message? Can you go back and fix it? Yes, you can by using git commit –amend. Here, let’s do it together.
Pull Request Workflow
Let’s walk through and discuss the pull request workflow. This process is your workflow for submitting your contribution for consideration to be added (merged) to the project. The steps: It starts on your local machine where you are building and validating your work in a branch. Then you push your branch to your forked copy of the project, i.e. in your GitHub project (which is the remote origin). Open a Pull Request and fill out relevant and informative information to tell the review team what your contribution is. If the project has a Continuous Integration (CI) server, your contribution is […]