On the second day of Commitmas, I had a new hurdle to jump — I forked @mjbrender’s repo, submitted a PR, and he accepted my changes as well as changes from @joshcoen and now my fork is outdated. How do I update my fork and local repo with the changes?
To rectify this, we’re going to leverage two git commands: git remote add upstream and git fetch upstream command.
With git remote add upstream, we’re going to specify the repository that we forked. In my case, I did:
git remote add upstream https://github.com/mjbrender/12-days-of-commitmas
A git remote -v verifies that we added the upstream source:
Then we perform git fetch upstream to copy the original repository (the one we forked) to our local repository (on our dev box):
Now we just fetched the upstream/master branch/repo and needs to be merged into our master branch. We can switch to our master branch with git checkout master.
Finally, git merge upstream/master to merge upstream/master to our master branch.
The final stretch! Our local repository is now a clone of the original repository again but we need to push our changes back to our repository on GItHub.
Done! Join in the Commitmas conversation on Twitter using the #vBrownBag hashtag! Happy committing!
My good friend Matthew Brender started a fun project for the holiday season called 12 Days of Commitmas to encourage everyone to continue to grow over the holiday season by learning or expanding their knowledge with git and coding. These skills will become increasingly prevalent and necessary in 2015 as more sysadmins and organizations implement version control to manage code for configuration management tools like Ansible.
When looking at the skill levels that Matt created, I found myself between beginner and intermediate. In the spirit of code contribution and learning git, and playing with Markdown, I submitted my first pull request on GitHub to expand the skill levels.
My Goal for Commitmas
Because my coding skills are relatively weak (improving them is a 2015 goal), I will contribute documentation to a project on GitHub. Internally on the SE team at PernixData, there are some PowerShell scripts that I will create repositories for in GitLab. I haven’t picked a project on GitHub yet to contribute to but I’m considering something related to Ansible. This will give me a chance to explore the different Ansible projects on GitHub and learn/do more with Markdown. I’m also going to push all of my commits using the CLI as I currently lean heavily on the GUI. I know there’s nothing wrong with using the GUI but I believe that true mastery comes from using the CLI when applicable.
Join in the Commitmas conversation on Twitter using the #vBrownBag hashtag! Happy committing!