-
Notifications
You must be signed in to change notification settings - Fork 0
Working In Teams With Git
When you're working in a team with Git, you'll inevitably have multiple people working on the code at once. The best way to deal with this is using branches.
Normally, you will want to create a new branch when you start adding any new feature or functionality. Then you can work off of that branch and commit as you please without interfering with the master branch. Then when your code is ready to be integrated into the master branch, you can merge your branch into the master branch. This will combine the changes made in each branch since the split point. Sometimes this will involve fixing merge conflicts, where Git doesn't know how to merge the code without breaking it.
The reason for doing all of this is so that you can guarantee that the code in the master branch is always functional, only has complete features, and is (hopefully) bug free.
To create and checkout a new branch, you can type
git checkout -b NEWBRANCHNAME
or you can use the branches tab in the Github app.
Now when you commit code, it will be added to the newly created branch. When you are done coding and testing your new feature, you can switch to the master branch and merge your branch into it:
git checkout master
git merge NEWBRANCHNAME
or you can use the merge view in the Github app.
If there are any conflicts, Git will let you know and place markers in the file to tell you what each branch added at a particular location. You will have to manually edit this to remove all the conflicts before you can commit.
- Home
- Game Design
- Tutorials & Walkthroughs
- Development Resources
- Game Deliverables
- Hack SF
- Games
- Blogging