Are you working on a team project using GitHub for the first time?
Start here!
Working in a group project can be intimidating.
Step 1: Add collaborators to the github repository
Step 2: Each collaborator needs to clone the project onto their local device
Step 3: Create a new branch for each feature!!
This is arguably the most important step, as it will help keep your git history in order. To create a branch, you will need just a few lines of code:
git pull
when you are in the main branch of the project
git checkout -b Branch_Name
to create your branch
Step 4: Edit your code and push your branch to the main
git add .
git commit -m "Clear Commit Message"
git push -u origin Branch_Name
Step 5: Merge your changes to the main
git checkout main
git merge Branch_Name
In a perfect world, this last step will go smoothly .. but say you and another collaborator have been editing the same files in different branches. When you push, this may lead to a (git) conflict.
Step 6: Resolve any conflicts in your editor or directly on github
Step 7: Once conflicts have been resolved, push to the main
git checkout main
Step 8 (optional): It's a good idea to delete your branch after it has been merged to the main
git branch -a
will show all the branches in your project
git branch -D Branch_Name
to delete a branch
Step 9: Enjoy your fully functional project!
Top comments (0)