top of page

Working with Git

Updated: Mar 23, 2021

Here Some New concepts introduced here are:


Branch


A branch is a copy of the main codebase that is hosted in the repository. All repositories start with one 'master' branch. You can create a new branch from the repository to build a new feature or run an experiment. Any commits made in a branch will not show up in master.


Merge


To merge is to join two GIT branches. For example, if you are done building a new feature in a branch, you can merge that branch into master. Once you are done the merging, all of the new commits made in the branch will be added to the master.


Fork


A fork is a copy of the entire repository. A fork includes not just the code, but also all of the branches and history of the repo. Working in a fork allows you to make changes to the repo without affecting the original.


Pull Request


When working in a team it is important to be able to see and approve changes made to the codebase. A pull request is a way for a collaborator to propose a set of changes. Pull requests are made from one branch to another, For example, if Alice were developing a feature in her fork of the main repository, she can create a pull request to the main repo so that her teammate Bob can see the proposed code changes to add a new feature. If the code changes are approved, then Alice can resolve the Pull Request by merging the branch.


Merge Conflict


One error that you might run into as you are collaborating with teammates is a merge conflict. If multiple collaborates edit the same file, GIT might not be able to resolve it automatically. When this happens it creates a merge conflict that the developers have to resolve manually.


Github team repository, organization, workflow


Now that you have a team, lets set up the Github organization, repository and practice the workflow. The team will only need to be step one time. The instructor will be using the commit history to see the work that each team member has put in, and it will factor into your grade for this project.


  • Start by creating a new team organization in Github.

At the top of the screen, you will see the option for creating a new organization.







Go ahead and follow the instructions to set up the organization and invite all of your team members.


  • Next, create a new team repository

When you create the new reop, you can set the owner to be the organization












Everyone on the team should be able to view this repository

  • Open up the repository that your team created, and fork the repository

You should see an option to fork the repository at the top right of the page.








Once you fork the repository you should see that you now have a copy of the entire project including the same commit history. you can see that repository was forked from organization repo.


  • Edit the README in your fork of the repo and commit the changes

In your fork of the repo, go ahead and edit README.md. Once you commit your changes, you should see that this branch is one commit ahead of the master repo.












I hope it may help with a basic concept regarding the GitHub if you need other help related to python, java, C, C++ or any other programming languages or projects related help then please contact us, so we can solve your issue. Please give an comments in below comments section so we can make changes if something missing or need for modification.


Comments


bottom of page