In week 3, we talked about staying synchronized with the upstream by using pull requests that are merged into the main branch by the maintainer. Synchronizing with the upstream ensures that your local and origin copies of the main branch have the same commits as the upstream main branch. One key thing I took from this week is when pull requests are merged into the upstream main, the main branches in the local and origin repos will get out of synch with the upstream. To start pulling from the upstream, the git remote -v command is first used to connect your local repository to the remote server. It lists the names and URLs of all the remote repositories that the local repo knows about. One other important git command used when synchronizing is git pull. To pull changes from the upstream, the main branch needs to be the active branch in the local repo. After this, git pull upstream main will pull and add commits from the main branch of the upstream repo to the main branch. After merging with the upstream, there’s no need to keep the feature branch and can therefore be deleted. Usually, developers will delete them to avoid having their repos becoming cluttered with old feature branches.
The blog for this week that I chose speaks about how to synch with the upstream and some of the git commands used. To start, you need to have an origin and upstream repo that are active. The command git remote -v helps verify that you have already setup a remote for the upstream repository. When you want to share some work with the upstream maintainers you branch off main and create a feature branch. When you’re done, you can push it to your remote repository and delete the feature branch after. Another important command is git status because it shows you how many commits you have of the synched remote branch. I chose this blog because it further broadens my knowledge on the git commands that are normally used with synchronizing with the upstream. I think it’s important to do research on the material your covering in class in order to improve on the knowledge you already have. This blog has a lot of the commands I used in the git homework 3 and it helped me be more familiar with the git commands. I really liked reading this blog and seeing how some of the things am studying in class are commonly used by developers in their day-to-day jobs.
Reference.
https://www.atlassian.com/git/tutorials/git-forks-and-upstreams
From the blog CS@Worcester – Site Title by lynnnsubuga and used with permission of the author. All other rights reserved by the author.