Git Pull Requests, Forking, and Collaborating on GitHub


Uncategorized

Updated Aug 9th, 2021

First video I watched here.

Fork is your own copy into it’s own repository. This is a good starting point to make a changes without affecting the original project.

From there you could make a pull request to the project and owner to have those changed be merged into the original repo.

From the owner’s perspective, they will see the pull request and can decide to accept changes and merge or deny.

Open source means anyone can see code, fork code, and submit pull requests.

What is the difference between a fork and a branch. A fork allows you to keep the branches separated by users.

The team video I watched here, shows how you would work on a project with three or four other developers.

The “git pull” command becomes crucial to make sure you always have the freshest copy. Make sure you are on the correct branch!

Make prospective changes on a new local branch. When your changes are finished do not merge to the master branch on the local repository and then push.

Instead we push the branch to the remote and the team will decide to accept or deny. After pushing you can go to GitHub and click “compare and pull request” button to compare the differences and create a pull request. Developers will get a ping on the pull request. You can add reviewers. You will get a notice on any potential merge conflicts.

If it is then everyone will need to “pull” the updated changes from the remote master branch so they are now working with the latest version of the code on their local machine.

Example:

Before starting a new branch make sure you pull down the latest version of the master or main. Make changes and add files to be tracked and commit the changes. Then push to the remote repo (not the local main/master!). In GitHub, (or using GitHub CLI), go to that commit and create a pull request. The reviewer will take a look and request changes or accept changes. Once the branch is merged to the master/main on the remote repo, you can delete the branch on local and then pull down the changes to from remote main to local main.


Top