Saturday, 19 December 2015

Version Control - 04.GitHub_Pull&Fork

GitHub Pull & Fork

Git Pull Request


When ever we forked another users repository and if we want to collaborate with them we can generate a pull request. After forking and cloning to our local computer if we do changes or some new codes have been added to the repository locally the same will be taking effect to the main repository as well. If we need these changes to made permanent to that repository as well then we need to generate a Pull request. Which will be notified to the owner of the main repository. After reviewing that person can accept or reject that request. If that request has been accepted then our changes will be merged to the main repository and committed.

To do this we need to login to our git account in the WebUI after that click on the "Pull Request" button and there after click on "Create Pull Request" button enter some info regarding the pull and click on "Send Pull Request" button.


Updating your Fork


It is also important to know why should we update our forks. Because so many users might be collaborating to the repository you are working and making changes on. In such case you might not know what the changes that have done by the other users. So if we have enabled upstream then every user can know what the other users have done to that repository. As enabling upstream will upload the changes made on their forks will let the other users know the changes.

Adding remote for upstream

# git remote add upstream <PATH_TO_REPO>
# git remote add upstream https://github.com/vmsnivas/bss.git

Fetch the Changes

# git fetch upstream

Merge them into master

# git merge upstream/master master 

Push the changes

# git push origin master

No comments :

Post a Comment