Happy Git with R

Happy Git with R
Author

YCB

Published

February 2, 2023

Prompt:

git and Github are tools for helping with versioning of files in collaborative efforts as well as archiving entries for your future self. Unfortunately working with git isn’t always completely straightforward. Jenny Bryan’s book “Happy git and github with R” helps with that. The book is available from http://happygitwithr.com/. Have a look over the index and pick one of the chapters for a more in-depth read.

Write a blog post answering the following questions:

  1. Write a short (100-150 words) summary of the chapter you read in-depth.

Chapter selected: 29 Pull, but you have local work This chapter introduce how to pull changes from upstream when you have local changes since the last pull. If the local changes do not affect the work from upstream, you can directly use ‘git pull’. If there are overlapped changes between remote and local files, you can either use ‘git stash’ or make a commit, which is preferred by the author. The simplest option is to fetch remote commits and merge them. For the conflicted parts, you need to either pick up one version of the changes or create a hybrid to resolve the conflicts. After using ‘git add’ to mark the files, you could commit and push. Another option is to use ‘git pull –rebase’, which pulls the upstream work in one commit and embodies the local work in another with no merge commits.

  1. Looking back at all of the team projects you have been involved in, describe the biggest mishap you had. Could that have been avoided using git? How?.

When working with others, I and my teammates did separate parts but we still looked at each other’s code and made small changes that we thought are necessary. But as time goes by, we forgot the changes we made and there is something we should not change or the code would crash. And it is hard to find out the problem because the code could be long. This can be avoided by using git. We can look at the commit history and it is easier to find which changes are made and which cause the problem.

  1. Give an example of one new git feature that you learned about from Jenny Bryan’s book..

‘git stash’ would be a new feature I never used before. This feature allows you to temporarily store the changes you made locally away. And then you are allowed to use other commands such as ‘git pull’. In the Chapter 29, they use ‘git stash store’ to store the local changes in the stash list and use ‘git stash pop’ to get back the stashed state and apply it to the current state.