Team Collaboration with GitHub
If you are looking for a job as a software engineer, you should be able to work with other developers using Git and GitHub, no matter what languages or frameworks you learned.
Git is a version control system designed to track changes in the source code of projects, whereas GitHub is a cloud-based hosting service for Git repositories. Companies worldwide use Git and GitHub, and recruiters might check your GitHub account before they give you an opportunity for an interview.
Here is the basic GitHub workflow:
1. Make feature branch from master branch
This is the first and important step in team development because the master branch always has to be deployable. Your branch name should be descriptive of the feature or fix you are going to work on.
# First, make sure you are in the master branch in the local repository.
git checkout master# Pull changes from the remote repository.
git pull# Create a new branch and checkout
git checkout -b feature-1
*If you create a feature branch from another branch by mistake, and cannot
git pull origin master later on, you can do so by doing
# Integrate changes from the master branch to the current branch
git rebase master
2. Add commits from feature branch
# Add changes in the staging area
git add file-name
git add .# Record staged changes with a log in the local repository
git commit -m "Descriptive Message"
Writing clear commit messages is important to make it easier for other people to follow and provide feedback.
3. Push commits and create Pull Request
Now you can push your changes to the remote repository so that your teammates have access to them.
# Push changes to the remote repositorygit push origin feature-1
Once you push the changes, you should be able to see the feature branch, and
Compare & pull request button on GitHub.
Compare & pull request button, choose the branches to merge, and reviewers, and leave comments you would like to share with the reviewers.
4. Get reviews from your team
Once a Pull Request has been opened, the reviewers get a notification and can make comments or discuss the code with you.
The reviewers can leave comments by clicking
+ button from the
Files changed tab in the Pull Request.
5. Merge to master branch
After the review is done and all the revisions are made, from the
Conversation tab in the Pull Request, the reviewer can finally merge the Pull Request to the master branch.
GitHub Guides, “Understanding the GitHub flow” https://guides.github.com/introduction/flow/